Built-In Namespace String
| Method Attributes | Method Name and Description |
|---|---|
|
arrayReplace(fromArray, toArray, dontEscape)
Replaces the occurences of the strings given in the fromArray with the toArray respectively.
|
|
|
BRtoLB()
Replaces any <br> or <br /> tags with line breaks(\n).
|
|
|
Escapes the special characters for a regular expression in the string.
|
|
|
format(The)
Formats a string according to the given parameters.
|
|
|
LBtoBR()
Replaces any line breaks (\n, \r, \r\n) with <br> tags.
|
|
|
strCount(searchStr, dontEscape)
Counts and returns the given string's occurances.
|
|
|
stripHTML(tags)
Strips all the HTML tags in the string.
|
|
|
trim()
Trims the whitespaces around the text.
|
|
|
trimLeft()
Trims the whitespaces in the beginning of the text.
|
|
|
Trims the whitespaces in the end of the text.
|
|
|
trimToLength(length)
Trims the string to the given length and puts ".
|
|
|
ucWords()
Makes the first letters of words uppercase.
|
Method Detail
{String}
arrayReplace(fromArray, toArray, dontEscape)
Replaces the occurences of the strings given in the fromArray with the toArray respectively.
Defined in: aV.ext.string.js.
Defined in: aV.ext.string.js.
var myText="I love Visual Basic, CGI-Script and Ruby very much!"; myText.arrayReplace(["Visual Basic", "CGI-Script", "Ruby"], ["PHP", "JavaScript"]);
Will give you "I love PHP, JavaScript and JavaScript very much!"
- Parameters:
- {String[]} fromArray
- The string array which holds the strings-to-be-replaced
- {String[]} toArray
- The string array which holds the strings-to-be-replaces-with. If the length of this array is smaller than the fromArray, then the last item of this array is used for undefined indexes.
- {Boolean} dontEscape Optional
- If given false the strings in the fromArray are used directly as regular expressions.
- Returns:
- {String}
{String}
BRtoLB()
Replaces any <br> or <br /> tags with line breaks(\n).
Defined in: aV.ext.string.js.
Defined in: aV.ext.string.js.
- Returns:
- {String}
{String}
escapeRegExp()
Escapes the special characters for a regular expression in the string.
Defined in: aV.ext.string.js.
Defined in: aV.ext.string.js.
- Returns:
- {String}
{String}
format(The)
Formats a string according to the given parameters.
Currently supports only string replacement.
Defined in: aV.ext.string.js.
Defined in: aV.ext.string.js.
"%s says this function is great but %2:s claims it's not".format("BYK", "useless", "snlzkn") will give you
BYK says this function is great but snlzkn claims it's not
- Parameters:
- {String|Number} The
- strings to be replaced, any number of parameters can be given.
- Returns:
- {String} The formatted string.
{String}
LBtoBR()
Replaces any line breaks (\n, \r, \r\n) with <br> tags.
Defined in: aV.ext.string.js.
Defined in: aV.ext.string.js.
- Returns:
- {String}
{integer}
strCount(searchStr, dontEscape)
Counts and returns the given string's occurances.
Defined in: aV.ext.string.js.
Defined in: aV.ext.string.js.
- Parameters:
- {String} searchStr
- The string whose occurenses will be counted.
- {Boolean} dontEscape Optional
- If given false, the searchStr is used directly as a regular expression.
- Returns:
- {integer}
{String}
stripHTML(tags)
Strips all the HTML tags in the string.
Removes only the given tags if tags is given
Defined in: aV.ext.string.js.
Defined in: aV.ext.string.js.
- Returns:
- {String}
{String}
trim()
Trims the whitespaces around the text.
Defined in: aV.ext.string.js.
Defined in: aV.ext.string.js.
- Returns:
- {String}
{String}
trimLeft()
Trims the whitespaces in the beginning of the text.
Defined in: aV.ext.string.js.
Defined in: aV.ext.string.js.
- Returns:
- {String}
{String}
trimRight()
Trims the whitespaces in the end of the text.
Defined in: aV.ext.string.js.
Defined in: aV.ext.string.js.
- Returns:
- {String}
{String}
trimToLength(length)
Trims the string to the given length and puts "..." in the end of the string.
Defined in: aV.ext.string.js.
Defined in: aV.ext.string.js.
- Parameters:
- {integer} length
- The desired maximum length of the string.
- Returns:
- {String}
{String}
ucWords()
Makes the first letters of words uppercase.
Defined in: aV.ext.string.js.
Defined in: aV.ext.string.js.
var myText="javascript is lovely."; myText.ucWords();
Will give you "Javascript Is Lovely."
- Returns:
- {String}