- |
-
-
- format( String string , String value1 , String value2 ) : String
- <static> Allows you to define a tokenized string and pass an arbitrary number of arguments to replace the token...
-
- <static> Allows you to define a tokenized string and pass an arbitrary number of arguments to replace the tokens. Each
+ Package: | Global | Defined In: | Ext.js,
Ext-more.js | Class: | String | Extends: | Object |
These functions are available on every String object. Public PropertiesThis class has no public properties. Public Methods|
| escape( String string )
+ :
+ String<static> Escapes the passed string for ' and \ <static> Escapes the passed string for ' and \ Parameters:string : StringThe string to escape Returns: | String | | format( String string , String value1 , String value2 )
+ :
+ String<static> Allows you to define a tokenized string and pass an arbitrary number of arguments to replace the tokens. Each
+token ... <static> Allows you to define a tokenized string and pass an arbitrary number of arguments to replace the tokens. Each
token must be unique, and must increment in the format {0}, {1}, etc. Example usage:
- var cls = 'my-class', text = 'Some text';
-var s = String.format('<div class="{0}">{1}</div>', cls, text);
-// s now contains the string: '<div class="my-class">Some text</div>'
- Parameters:
-
- Returns:
-
- String The formatted string
-
-
-
-
- |
- String |
-
-
- |
-
-
- leftPad( String string , Number size , [String char ] ) : String
- <static> Pads the left side of a string with a specified character. This is especially useful
-for normalizing ...
-
- <static> Pads the left side of a string with a specified character. This is especially useful
+ var cls = 'my-class', text = 'Some text';
+var s = String.format('<div class="{0}">{1}</div>', cls, text);
+// s now contains the string: '<div class="my-class">Some text</div>'
Parameters:Returns:String The formatted string
| String | | leftPad( String string , Number size , [String char ] )
+ :
+ String<static> Pads the left side of a string with a specified character. This is especially useful
+for normalizing number and date... <static> Pads the left side of a string with a specified character. This is especially useful
for normalizing number and date strings. Example usage:
- var s = String.leftPad('123', 5, '0');
-// s now contains the string: '00123'
- Parameters:
-
- Returns:
-
- String The padded string
-
-
-
-
- |
- String |
-
-
- |
-
-
- toggle( String value , String other ) : String
- Utility function that allows you to easily switch a string between two alternating values. The passed value
-is compa...
-
- Utility function that allows you to easily switch a string between two alternating values. The passed value
+ var s = String.leftPad('123', 5, '0');
+// s now contains the string: '00123'
| String | | toggle( String value , String other )
+ :
+ StringUtility function that allows you to easily switch a string between two alternating values. The passed value
+is compa... Utility function that allows you to easily switch a string between two alternating values. The passed value
is compared to the current string, and if they are equal, the other value that was passed in is returned. If
they are already different, the first value passed in is returned. Note that this method returns the new value
but does not change the current string.
@@ -109,45 +24,10 @@ but does not change the current string.
sort = sort.toggle( 'ASC', 'DESC');
// instead of conditional logic:
-sort = (sort == 'ASC' ? 'DESC' : 'ASC');
- Parameters:
-
- Returns:
-
-
-
-
- |
- String |
-
-
- |
-
-
- trim() : String
- Trims whitespace from either end of a string, leaving spaces within the string intact. Example:
-var s = ' foo bar ...
-
- Trims whitespace from either end of a string, leaving spaces within the string intact. Example:
- var s = ' foo bar ';
+sort = (sort == 'ASC' ? 'DESC' : 'ASC');
| String | | trim()
+ :
+ StringTrims whitespace from either end of a string, leaving spaces within the string intact. Example:
+var s = ' foo bar ... Trims whitespace from either end of a string, leaving spaces within the string intact. Example:
+ var s = ' foo bar ';
alert('-' + s + '-'); //alerts "- foo bar -"
-alert('-' + s.trim() + '-'); //alerts "-foo bar-"
- Parameters:
-
- Returns:
-
- String The trimmed string
-
-
-
-
- |
- String |
-
-
-
- Public Events
- This class has no public events.
-
\ No newline at end of file
+alert( '-' + s.trim() + '-'); //alerts "-foo bar-" | String |