Interface JSStringFunctions
- All Superinterfaces:
JSObjectFunctions
-
Method Summary
Modifier and TypeMethodDescriptionfunction charAt(position) get the nth character from a string.charCodeAt(JSNumber position) function charCodeAt(position) get the nth character code from a string.function concat(value1, ...) concatenate stringsfunction indexOf(searchString, startPosition) search a string.lastIndexOf(JSString searchString, JSNumber startPosition) function lastIndexOf(searchString, startPosition) search a string backward.localeCompare(JSString otherString) function localeCompare(otherString) compare one string to another, using locale-specific ordering.function match(regexp) find one or more regular-expression matchesfunction replace(regexp, replaceValue) replace substring(s) matching a regular expression.function search(regexp) search for a regular expressionfunction slice(start, end) extract a substring.function split(separator, limit) break a string into an array of strings.function substring(from, to) return a substring of a string.function toLocaleLowerCase() Converts a string to lower case.function toLocaleUpperCase() Converts a string to upper case.function toLowerCase() Converts a string to lower case.function toUpperCase() Converts a string to upper case.Methods inherited from interface JSObjectFunctions
hasOwnProperty, isPrototypeOf, propertyIsEnumerable, toLocaleString, toString, valueOf
-
Method Details
-
charAt
-
charCodeAt
-
concat
-
indexOf
function indexOf(searchString, startPosition) search a string.- Parameters:
searchString- The substring to be search within string.startPosition- Optional start index.- Since:
- Standard ECMA-262 3rd. Edition, Level 2 Document Object Model Core Definition.
- See Also:
-
lastIndexOf
function lastIndexOf(searchString, startPosition) search a string backward.- Parameters:
searchString- The substring to be search within string.startPosition- Optional start index.- Since:
- Standard ECMA-262 3rd. Edition, Level 2 Document Object Model Core Definition.
- See Also:
-
localeCompare
function localeCompare(otherString) compare one string to another, using locale-specific ordering.Example
var string;//array of string initialised somewhere strings.sort(function(a,b){return a.localCompare(b);});- Parameters:
otherString- A string to be compared, in a locale-sensitive fashion, with string.- Since:
- Standard ECMA-262 3rd. Edition, Level 2 Document Object Model Core Definition.
- See Also:
-
match
-
replace
function replace(regexp, replaceValue) replace substring(s) matching a regular expression.- Parameters:
regexp- A RegExp object that specifies the pattern to be replaced.replaceValue- A string that specifies the replacement text.- Since:
- Standard ECMA-262 3rd. Edition, Level 2 Document Object Model Core Definition.
- See Also:
-
search
-
slice
function slice(start, end) extract a substring.Example
var s = "abcdefg"; s.slice(0,4); //returns "abcd" s.slice(2,4); //returns "cd" s.slice(4); //returns "efg" s.slice(3, -1); //returns "def" s.slice(3,-2); //returns "de"
- Parameters:
start- The start index where the slice if to begin.end- Optional end index where the slice is to end.- Since:
- Standard ECMA-262 3rd. Edition, Level 2 Document Object Model Core Definition.
- See Also:
-
split
function split(separator, limit) break a string into an array of strings.Example
"1|2|3|4".split("|"); //returns ["1","2","3","4"] "%1%2%3%4%".split("%"); //returns ["","1","2","3","4",""]- Parameters:
separator- The string or regular expression at which the string splitslimit- Optional value that specifies the maximum length of the returned array.- Since:
- Standard ECMA-262 3rd. Edition, Level 2 Document Object Model Core Definition.
- See Also:
-
substring
function substring(from, to) return a substring of a string.- Parameters:
from- The index where to start the extraction. First character is at index 0to- Optional. The index where to stop the extraction. If omitted, it extracts the rest of the string- Since:
- Standard ECMA-262 3rd. Edition, Level 2 Document Object Model Core Definition.
- See Also:
-
toLowerCase
JSString toLowerCase()function toLowerCase() Converts a string to lower case.- Since:
- Standard ECMA-262 3rd. Edition, Level 2 Document Object Model Core Definition.
- See Also:
-
toLocaleLowerCase
JSString toLocaleLowerCase()function toLocaleLowerCase() Converts a string to lower case.- Since:
- Standard ECMA-262 3rd. Edition, Level 2 Document Object Model Core Definition.
- See Also:
-
toUpperCase
JSString toUpperCase()function toUpperCase() Converts a string to upper case.- Since:
- Standard ECMA-262 3rd. Edition, Level 2 Document Object Model Core Definition.
- See Also:
-
toLocaleUpperCase
JSString toLocaleUpperCase()function toLocaleUpperCase() Converts a string to upper case.- Since:
- Standard ECMA-262 3rd. Edition, Level 2 Document Object Model Core Definition.
- See Also:
-