/* This file is part of Ext JS 3.4 Copyright (c) 2011-2013 Sencha Inc Contact: http://www.sencha.com/contact GNU General Public License Usage This file may be used under the terms of the GNU General Public License version 3.0 as published by the Free Software Foundation and appearing in the file LICENSE included in the packaging of this file. Please review the following information to ensure the GNU General Public License version 3.0 requirements will be met: http://www.gnu.org/copyleft/gpl.html. If you are unsure which license is appropriate for your use, please contact the sales department at http://www.sencha.com/contact. Build date: 2013-04-03 15:07:25 */ Ext.data.JsonP.String({"alternateClassNames":[],"aliases":{},"enum":null,"parentMixins":[],"tagname":"class","subclasses":[],"extends":null,"uses":[],"html":"

Files

These functions are available as static methods on the JavaScript String object.

\n

Methods

Defined By

Instance Methods

( 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 = sort.toggle('ASC', 'DESC');\n\n// instead of conditional logic:\nsort = (sort == 'ASC' ? 'DESC' : 'ASC');\n
\n\n

Parameters

  • 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

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('-' + s.trim() + '-');  //alerts \"-foo bar-\"\n
\n\n

Returns

Defined By

Static Methods

( string ) : Stringstatic
Escapes the passed string for ' and \\ ...

Escapes the passed string for ' and \\

\n

Parameters

  • string : String

    The string to escape

    \n

Returns

( string, value1, value2 ) : Stringstatic
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', text = 'Some text';\nvar s = String.format('<div class=\"{0}\">{1}</div>', cls, text);\n// s now contains the string: '<div class=\"my-class\">Some text</div>'\n
\n\n

Parameters

  • string : String

    The tokenized string to be formatted

    \n
  • value1 : String

    The value to replace token {0}

    \n
  • value2 : String

    Etc...

    \n

Returns

( string, size, [char] ) : Stringstatic
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 = String.leftPad('123', 5, '0');\n// s now contains the string: '00123'\n
\n\n

Parameters

  • string : String

    The original string

    \n
  • size : Number

    The total length of the output string

    \n
  • char : String (optional)

    The character with which to pad the original string (defaults to empty string \" \")

    \n

Returns

","superclasses":[],"meta":{},"requires":[],"html_meta":{},"statics":{"property":[],"cfg":[],"css_var":[],"method":[{"tagname":"method","owner":"String","meta":{"static":true},"name":"escape","id":"static-method-escape"},{"tagname":"method","owner":"String","meta":{"static":true},"name":"format","id":"static-method-format"},{"tagname":"method","owner":"String","meta":{"static":true},"name":"leftPad","id":"static-method-leftPad"}],"event":[],"css_mixin":[]},"files":[{"href":"Ext-more.html#String","filename":"Ext-more.js"},{"href":"Ext.html#String","filename":"Ext.js"}],"linenr":578,"members":{"property":[],"cfg":[],"css_var":[],"method":[{"tagname":"method","owner":"String","meta":{},"name":"toggle","id":"method-toggle"},{"tagname":"method","owner":"String","meta":{},"name":"trim","id":"method-trim"}],"event":[],"css_mixin":[]},"inheritable":null,"private":null,"component":false,"name":"String","singleton":false,"override":null,"inheritdoc":null,"id":"class-String","mixins":[],"mixedInto":[]});