RIATest 2 Documentation Copyright © RIATest.com

String Object

Object is an unordered collection of properties each of which contains a primitive value or another object.

Methods

MethodDescription

String

new String([value])
Creates a new String. If value is omited empty String is created otherwise a toString method is called on value and result is returned as new String.

charAt

charAt(pos)
Returns a string containing the character at position pos in the string. If there is no character at that position, the result is the empty string.

charCodeAt

charCodeAt(pos)
Returns a number (a nonnegative integer less than 2^16) representing the code point value of the character at position pos in the string. If there is no character at that position, the result is NaN.

concat

concat([string1[,string2[,...]]])
Concatenate this string followed by the given arguments.

indexOf

indexOf(searchString,position)
If searchString appears as a substring of this string, at one or more positions that are greater than or equal to position, then the index of the smallest such position is returned; otherwise, -1 is returned. If position is undefined, 0 is assumed, so as to search all of the string.

lastIndexOf

lastIndexOf(searchString,position)
If searchString appears as a substring of this string, at one or more positions that are smaller than or equal to position, then the index of the greatest such position is returned; otherwise, -1 is returned. If position is undefined, the length of the string value is assumed, so as to search all of the string.

localeCompare

localeCompare(that)
When the localeCompare method is called with one argument, it returns a number other than NaN that represents the result of a locale-sensitive string comparison of this string with argument (converted to a string).

replace

replace(searchValue,replaceValue)
Returns a string value that result from replacing each matched search substring with the replace string.

slice

slice(start,end)
The slice method takes two arguments, start and end, and returns a substring of this string, starting from character position start and running to, but not including, character position end (or through the end of the string if end is undefined). If start is negative, it is treated as (sourceLength+start) where sourceLength is the length of this string. If end is negative, it is treated as (sourceLength+end) where sourceLength is the length of this string.

split

split(separator,limit)
Returns an Array object into which substrings of the result of this string have been stored. The substrings are determined by searching from left to right for occurrences of separator; these occurrences are not part of any substring in the returned array, but serve to divide up the string value. If separator is the empty string, the string is split up into individual characters; the length of the result array equals the length of the string, and each substring contains one character.

substring

substring(start,end)
The substring method takes two arguments, start and end, and returns a substring of the result of this string, starting from character position start and running to, but not including, character position end of the string (or through the end of the string is end is undefined).

toLowerCase

toLowerCase()
Return a copy of the string converted to lower case. The characters in this string are converted one by one to lower case. The result of each conversion is the original character, unless that character has a Unicode lowercase equivalent, in which case the lowercase equivalent is used instead.

toString

toString()
Returns string representation of this object.

toUpperCase

toUpperCase()
Return a copy of the string converted to uppaer case. The characters in this string are converted one by one to upper case. The result of each conversion is the original character, unless that character has a Unicode uppercase equivalent, in which case the uppercase equivalent is used instead.

valueOf

valueOf()
Returns this string value.