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.

\n
Defined By

Methods

Ext.String
view source
( entities )
Adds a set of character entity definitions to the set used by\nhtmlEncode and htmlDecode. ...

Adds a set of character entity definitions to the set used by\nhtmlEncode and htmlDecode.

\n\n

This 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\n

Note: 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\n

The set of character entities may be reset back to the default state by using\nthe resetCharacterEntities method

\n

Parameters

  • entities : Object

    The set of character entities to add to the current\ndefinitions.

    \n
Ext.String
view source
( string ) : String
Capitalize the given string ...

Capitalize the given string

\n

Parameters

Returns

Converts a string of characters into a legal, parse-able JavaScript var name as long as the passed\nstring contains at...

Converts 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.

\n

Parameters

  • s : String

    A string to be converted into a var name.

    \n

Returns

  • String

    A legal JavaScript var name.

    \n
Ext.String
view source
( value, length, [word] ) : String
Truncate a string and add an ellipsis ('...') to the end if it exceeds the specified length. ...

Truncate a string and add an ellipsis ('...') to the end if it exceeds the specified length.

\n

Parameters

  • value : String

    The string to truncate.

    \n
  • length : Number

    The maximum length to allow before truncating.

    \n
  • word : Boolean (optional)

    true to try to find a common word break.

    \n

    Defaults to: false

Returns

Ext.String
view source
( s, start, [ignoreCase] )
Checks if a string ends with a substring ...

Checks if a string ends with a substring

\n

Parameters

  • s : String

    The original string

    \n
  • start : String

    The substring to check

    \n
  • ignoreCase : Boolean (optional)

    True to ignore the case in the comparison

    \n

    Defaults to: false

Ext.String
view source
( string ) : String
Escapes the passed string for ' and \\ ...

Escapes the passed string for ' and \\

\n

Parameters

  • string : String

    The string to escape

    \n

Returns

Ext.String
view source
( string ) : String
Escapes the passed string for use in a regular expression. ...

Escapes the passed string for use in a regular expression.

\n

Parameters

Returns

Ext.String
view source
( string, values ) : String
Allows you to define a tokenized string and pass an arbitrary number of arguments to replace the tokens. ...

Allows 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\n
var 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
\n

Parameters

  • string : String

    The tokenized string to be formatted.

    \n
  • values : Mixed...

    The values to replace tokens {0}, {1}, etc in order.

    \n

Returns

Ext.String
view source
( value ) : String
Convert certain characters (&, <, >, ', and \") from their HTML character equivalents. ...

Convert certain characters (&, <, >, ', and \") from their HTML character equivalents.

\n

Parameters

  • value : String

    The string to decode.

    \n

Returns

Ext.String
view source
( value ) : String
Convert certain characters (&, <, >, ', and \") to their HTML character equivalents for literal display in web ...

Convert certain characters (&, <, >, ', and \") to their HTML character equivalents for literal display in web pages.

\n

Parameters

  • value : String

    The string to encode.

    \n

Returns

Ext.String
view source
( s, value, index ) : String
Inserts a substring into a string. ...

Inserts a substring into a string.

\n

Parameters

  • s : String

    The original string.

    \n
  • value : String

    The substring to insert.

    \n
  • index : Number

    The index to insert the substring. Negative indexes will insert from the end of\nthe string. Example:

    \n\n
    Ext.String.insert(\"abcdefg\", \"h\", -1); // abcdefhg\n
    \n

Returns

  • String

    The value with the inserted substring

    \n
Ext.String
view source
( string, size, [character] ) : String
Pads the left side of a string with a specified character. ...

Pads the left side of a string with a specified character. This is especially useful\nfor normalizing number and date strings. Example usage:

\n\n
var s = Ext.String.leftPad('123', 5, '0');\n// s now contains the string: '00123'\n
\n

Parameters

  • string : String

    The original string.

    \n
  • size : Number

    The total length of the output string.

    \n
  • character : String (optional)

    The character with which to pad the original string.

    \n

    Defaults to: ' '

Returns

Ext.String
view source
( pattern, count, sep )
Returns a string with a specified number of repetitions a given string pattern. ...

Returns 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
\n

Parameters

  • pattern : String

    The pattern to repeat.

    \n
  • count : Number

    The number of times to repeat the pattern (may be 0).

    \n
  • sep : String

    An option string to separate each pattern.

    \n
Resets the set of character entity definitions used by\nhtmlEncode and htmlDecode back to the\ndefault state. ...

Resets the set of character entity definitions used by\nhtmlEncode and htmlDecode back to the\ndefault state.

\n
Ext.String
view source
( words )
Splits a string of space separated words into an array, trimming as needed. ...

Splits a string of space separated words into an array, trimming as needed. If the\nwords are already an array, it is returned.

\n

Parameters

Ext.String
view source
( s, start, [ignoreCase] )
Checks if a string starts with a substring ...

Checks if a string starts with a substring

\n

Parameters

  • s : String

    The original string

    \n
  • start : String

    The substring to check

    \n
  • ignoreCase : Boolean (optional)

    True to ignore the case in the comparison

    \n

    Defaults to: false

Ext.String
view source
( string, value, other ) : String
Utility function that allows you to easily switch a string between two alternating values. ...

Utility 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
\n

Parameters

  • string : String

    The current string.

    \n
  • value : String

    The value to compare to the current string.

    \n
  • other : String

    The new value to use if the string already equals the first value passed in.

    \n

Returns

Ext.String
view source
( string ) : String
Trims whitespace from either end of a string, leaving spaces within the string intact. ...

Trims whitespace from either end of a string, leaving spaces within the string intact. Example:

\n\n
var s = '  foo bar  ';\nalert('-' + s + '-');                   //alerts \"- foo bar -\"\nalert('-' + Ext.String.trim(s) + '-');  //alerts \"-foo bar-\"\n
\n

Parameters

  • string : String

    The string to trim.

    \n

Returns

Ext.String
view source
( string ) : String
Uncapitalize the given string. ...

Uncapitalize the given string.

\n

Parameters

Returns

Ext.String
view source
( url, string ) : String
Appends content to the query string of a URL, handling logic for whether to place\na question mark or ampersand. ...

Appends content to the query string of a URL, handling logic for whether to place\na question mark or ampersand.

\n

Parameters

  • url : String

    The URL to append to.

    \n
  • string : String

    The content to append to the URL.

    \n

Returns

","superclasses":[],"meta":{},"requires":[],"html_meta":{},"statics":{"property":[],"cfg":[],"css_var":[],"method":[],"event":[],"css_mixin":[]},"files":[{"href":"String2.html#Ext-String","filename":"String.js"}],"linenr":5,"members":{"property":[],"cfg":[],"css_var":[],"method":[{"tagname":"method","owner":"Ext.String","meta":{},"name":"addCharacterEntities","id":"method-addCharacterEntities"},{"tagname":"method","owner":"Ext.String","meta":{},"name":"capitalize","id":"method-capitalize"},{"tagname":"method","owner":"Ext.String","meta":{},"name":"createVarName","id":"method-createVarName"},{"tagname":"method","owner":"Ext.String","meta":{},"name":"ellipsis","id":"method-ellipsis"},{"tagname":"method","owner":"Ext.String","meta":{},"name":"endsWith","id":"method-endsWith"},{"tagname":"method","owner":"Ext.String","meta":{},"name":"escape","id":"method-escape"},{"tagname":"method","owner":"Ext.String","meta":{},"name":"escapeRegex","id":"method-escapeRegex"},{"tagname":"method","owner":"Ext.String","meta":{},"name":"format","id":"method-format"},{"tagname":"method","owner":"Ext.String","meta":{},"name":"htmlDecode","id":"method-htmlDecode"},{"tagname":"method","owner":"Ext.String","meta":{},"name":"htmlEncode","id":"method-htmlEncode"},{"tagname":"method","owner":"Ext.String","meta":{},"name":"insert","id":"method-insert"},{"tagname":"method","owner":"Ext.String","meta":{},"name":"leftPad","id":"method-leftPad"},{"tagname":"method","owner":"Ext.String","meta":{},"name":"repeat","id":"method-repeat"},{"tagname":"method","owner":"Ext.String","meta":{},"name":"resetCharacterEntities","id":"method-resetCharacterEntities"},{"tagname":"method","owner":"Ext.String","meta":{},"name":"splitWords","id":"method-splitWords"},{"tagname":"method","owner":"Ext.String","meta":{},"name":"startsWith","id":"method-startsWith"},{"tagname":"method","owner":"Ext.String","meta":{},"name":"toggle","id":"method-toggle"},{"tagname":"method","owner":"Ext.String","meta":{},"name":"trim","id":"method-trim"},{"tagname":"method","owner":"Ext.String","meta":{},"name":"uncapitalize","id":"method-uncapitalize"},{"tagname":"method","owner":"Ext.String","meta":{},"name":"urlAppend","id":"method-urlAppend"}],"event":[],"css_mixin":[]},"inheritable":null,"private":null,"component":false,"name":"Ext.String","singleton":true,"override":null,"inheritdoc":null,"id":"class-Ext.String","mixins":[],"mixedInto":[]});