Ext.data.JsonP.Ext_String({"alternateClassNames":[],"aliases":{},"enum":null,"parentMixins":[],"tagname":"class","subclasses":[],"extends":null,"uses":[],"html":"
Files
A collection of useful static methods to deal with strings.
\nAdds a set of character entity definitions to the set used by\nhtmlEncode and htmlDecode.
\n\nThis object should be keyed by the entity name sequence,\nwith the value being the textual representation of the entity.
\n\n Ext.String.addCharacterEntities({\n 'Ü':'Ü',\n 'ç':'ç',\n 'ñ':'ñ',\n 'è':'è'\n });\n var s = Ext.String.htmlEncode(\"A string with entities: èÜçñ\");\n
\n\nNote: the values of the character entities defined on this object are expected\nto be single character values. As such, the actual values represented by the\ncharacters are sensitive to the character encoding of the JavaScript source\nfile when defined in string literal form. Script tags referencing server\nresources with character entities must ensure that the 'charset' attribute\nof the script node is consistent with the actual character encoding of the\nserver resource.
\n\nThe set of character entities may be reset back to the default state by using\nthe resetCharacterEntities method
\nThe set of character entities to add to the current\ndefinitions.
\nConverts a string of characters into a legal, parse-able JavaScript var
name as long as the passed\nstring contains at least one alphabetic character. Non alphanumeric characters, and leading non alphabetic\ncharacters will be removed.
A string to be converted into a var
name.
A legal JavaScript var
name.
Truncate a string and add an ellipsis ('...') to the end if it exceeds the specified length.
\nThe string to truncate.
\nThe maximum length to allow before truncating.
\ntrue
to try to find a common word break.
Defaults to: false
The converted text.
\nAllows you to define a tokenized string and pass an arbitrary number of arguments to replace the tokens. Each\ntoken must be unique, and must increment in the format {0}, {1}, etc. Example usage:
\n\nvar cls = 'my-class',\n text = 'Some text';\nvar s = Ext.String.format('<div class=\"{0}\">{1}</div>', cls, text);\n// s now contains the string: '<div class=\"my-class\">Some text</div>'\n
\nThe tokenized string to be formatted.
\nThe values to replace tokens {0}
, {1}
, etc in order.
The formatted string.
\nInserts a substring into a string.
\nThe original string.
\nThe substring to insert.
\nThe index to insert the substring. Negative indexes will insert from the end of\nthe string. Example:
\n\nExt.String.insert(\"abcdefg\", \"h\", -1); // abcdefhg\n
\nThe value with the inserted substring
\nPads the left side of a string with a specified character. This is especially useful\nfor normalizing number and date strings. Example usage:
\n\nvar s = Ext.String.leftPad('123', 5, '0');\n// s now contains the string: '00123'\n
\nThe original string.
\nThe total length of the output string.
\nThe character with which to pad the original string.
\nDefaults to: ' '
The padded string.
\nReturns a string with a specified number of repetitions a given string pattern.\nThe pattern be separated by a different string.
\n\n var s = Ext.String.repeat('---', 4); // = '------------'\n var t = Ext.String.repeat('--', 3, '/'); // = '--/--/--'\n
\nResets the set of character entity definitions used by\nhtmlEncode and htmlDecode back to the\ndefault state.
\nUtility function that allows you to easily switch a string between two alternating values. The passed value\nis compared to the current string, and if they are equal, the other value that was passed in is returned. If\nthey are already different, the first value passed in is returned. Note that this method returns the new value\nbut does not change the current string.
\n\n// alternate sort directions\nsort = Ext.String.toggle(sort, 'ASC', 'DESC');\n\n// instead of conditional logic:\nsort = (sort === 'ASC' ? 'DESC' : 'ASC');\n
\nThe current string.
\nThe value to compare to the current string.
\nThe new value to use if the string already equals the first value passed in.
\nThe new value.
\nTrims whitespace from either end of a string, leaving spaces within the string intact. Example:
\n\nvar s = ' foo bar ';\nalert('-' + s + '-'); //alerts \"- foo bar -\"\nalert('-' + Ext.String.trim(s) + '-'); //alerts \"-foo bar-\"\n
\nThe string to trim.
\nThe trimmed string.
\n