for (var codepoint in str) {...}
Iterates all UNICODE code points in string. Internally strings are stored as arrays of UTF16 code units and str.length
reports number of UTF16 code units. In contrary, on each iteration the codepoint variable receives integer value - UNICODE code point. Note that number of iterations can be less than str.length
if the string contains so called surrogate pairs - symbols presented by two UTF16 code units.
for (var (strpos,codepoint) in str) {...}
Does the same as the above but also reports position (index) of the codepoint in string.
Creates new string of given size and fill.
Tries to parse content of the string. If parsing failed then returns defaultValue if provided, or undefined value.
toInteger expects string in the following format:
[whitespace] [{+ | -}] [0 [{ x | X }]] [digits]
Tries to parse content of the string. If parsing failed then returns defaultValue if provided, or undefined value.
toFloat expects string in the following format:
[whitespace] [sign] [digits] [.digits] [ {d | D | e | E}[sign]digits]
Tries to parse the string into either float or integer value. This is an equivalent of:
var n = s.toInteger( s.toFloat() );
Returns string itself.
Returns string escaped by html rules. Is an alias of the htmlEscape() method.
Returns string escaped by URL rules. It is an equivalent of URL.escape(string)
or, if #as-parameter
provided, URL.escapeParam(string)
.
start and end are integers - zero-based indexes of first and last character. Method returns string slice consisting from characters starting from start index and up to but not included end index. If end is omitted it is interpretted as equal to length.
Negative values of start or end treated as a "right side indexes" thus expression "Script".substring(0,-1) == "Script" is valid.
start and length are integers. Start is zero-based index of first character and length is a number of characters in the slice.
Negative value of start interpreted as a "right side index" thus expression "Script".substr(-6) == "Script" is valid.
Equivalent of substring method.
This method:
Returns string consisting from concatenated arguments: self + string1 + string2 + string3 + ... + stringN.
Returns one character string. Equivalent of substr( index, 1 ). If index is out of bounds of the string then charAt returns empty string.
Returns (uni)code of character at index position.
Searches this string for text in substring. Returns index of first occurence of substring or -1 if not found.
Searches this string for text in substring. Returns index of last occurence of substring or -1 if not found.
Compares this string with what string using lexicographic character order. For example: "ABC" < "abc"
is true but "ABC".lexicalCompare("abc")
yelds to >= 1. If caseInsensitive is provided and true it does case insensitive comparison. By default comparison is case sensitive.
The function returns Levenshtein distance between this string and the other. Distance is a non-negative integer, larger - less similarity between these strings.
Returns fragment(s) of the string which satisfy regexp.
Returns RegExp object instance which satisfy string pattern.
Returns copy of the string where all fragments satisfying regexp are replaced by replaceBy. If replaceBy is a function then this function will be called for each matching substring with parameters corresponding to the whole match and each matched sub-group.
This example:
var s = "212F"; var test = /(\d+(?:\.\d*)?)F\b/g; function f2c(str, g1) { return ((g1.toNumber() - 32) * 5/9) + "C"; } stdout.printf("%V\n", s.replace(test, f2c ));
will convert each Fahrenheit to Celsius number in the given string (s).
Returns index of first occurence of string fragment satisfying regexp or -1 if not found.
Splits the string separated on components by separator. Separator is either regexp object or string. Returns array of strings - substrings between separators. Limit is an integer - maximum number of elements in returned array.
Static method. Returns string build from character with given integer codes.
Returns lower case copy of the string.
Returns upper case copy of the string.
Returns copy of the string with spaces removed.
Returns url-escaped copy of the string if it contains characters need to be escaped or string itself if there are no such characters. Note that non-ascii characters are converted to utf-8 sequences first and resulting codes will be escaped.
Restores url-escaped string.
Returns string where each < > & " or ' ۪̉ character replaced by < > & " or ' sequence.
Returns string where html entities replaced by correspondent character codes.
static method, returns composed string. Note, this is a "stringizer" method.
Example, this:
var pt = { x:12, y:42 }; var msg = String.$(coordinates are x:{ pt.x } y:{ pt.y });
produces string "coordinates are x:12 y:42"
in msg
variable.
Static method. Returns string formatted by the rules of sprintf C/C++ function.
Scans the string for values according to the rules of scanf C/C++ function with wildcard (like %[a-z] ) extensions. See definition of scanf in MSDN.
Additional format types:
Function returns array of successfully parsed values.
Static method. Returns UUID - universally unique identifier. On Windows it uses UuidCreate() and libuuid on other platforms.