无法在 ExtJS 2 中使用字符串函数

Not able to use string function in ExtJS 2

我正在使用 rally sdk2 app & ExtJS 2,我想获取所有以 "Release" 开头的版本名称,所以我将此函数 startsWith( s, start, [ignoreCase] ) 用作 Ext.String.startsWith(rName, "Release") 但它给出了我的错误未定义不是函数。 我知道这是一件小事,但我没有让它工作

在 Ext JS 2.0 中没有 Ext.String class 也没有 startsWith 方法。 Class 从 4.0 开始可用,方法从 4.2 开始可用。 Here 是 fiddle 这表明它在 5.0 中有效。

您可以使用 indexOf 轻松代替:rName.indexOf("Release") === 0