String
API documention for the Prototype String.
Prototype for the primitive string type.
Source code
Usage
var instance = new String(args);
...
instance.method(args);
Index
Constructor
Variables
-- No Variables --
Getters & Setters
(get) empty
Static
Returns an empty string.
(get) length
Gets the amount of characters in the string.
Static
Returns an empty string.
Type: string
Usage: var empty = String.empty;
(get) length
Gets the amount of characters in the string.
Type: int
Usage: var length = s.length;
Methods
charAt
Returns a character within the string.
concat
Concatenates multiple strings to this string.
endsWith
Returns whether the string ends with another string.
includes
Returns whether the string contains another string.
indexOf
Returns the index of the first occurrence of a string within this string.
lastIndexOf
Returns the index of the last occurrence of a string within this string.
padEnd
Pads the end of the string until the string reaches a certain length.
Signatures:
padStart
Pads the start of the string until the string reaches a certain length.
Signatures:
remove
Removes a set of characters from the string.
repeat
Repeats the string a number of times.
replace
Replaces parts within the string with another string.
slice
Returns a slice of the string.
Signatures:
split
Splits the string at a delimiter.
Signatures:
startsWith
Returns whether the string starts with another string.
toLower
Converts all alphabetic characters in the string to their lower case counterparts.
toUpper
Converts all alphabetic characters in the string to their upper case counterparts.
trim
Trims characters from the start and end of the string.
Signatures:
trimEnd
Trims characters from the end of the string.
Signatures:
trimStart
Trims characters from the start of the string.
Signatures:
Returns a character within the string.
concat
Concatenates multiple strings to this string.
endsWith
Returns whether the string ends with another string.
includes
Returns whether the string contains another string.
indexOf
Returns the index of the first occurrence of a string within this string.
lastIndexOf
Returns the index of the last occurrence of a string within this string.
padEnd
Pads the end of the string until the string reaches a certain length.
Signatures:
Return: string
Arguments: int targetLength, string padStr
Usage: var result = s.padEnd(targetLength, padStr);
padStart
Pads the start of the string until the string reaches a certain length.
Signatures:
Return: string
Arguments: int targetLength, string padStr
Usage: var result = s.padStart(targetLength, padStr);
remove
Removes a set of characters from the string.
Return: string
Arguments: int startIndex, [int length]
Usage: var result = s.remove(startIndex, [length]);
repeat
Repeats the string a number of times.
replace
Replaces parts within the string with another string.
slice
Returns a slice of the string.
Signatures:
split
Splits the string at a delimiter.
Signatures:
Return: string[]
Arguments: string[] delimiters, [int limit]
Usage: var result = s.split(delimiters, [limit]);
Return: string[]
Arguments: string delimiter, [int limit]
Usage: var result = s.split(delimiter, [limit]);
startsWith
Returns whether the string starts with another string.
toLower
Converts all alphabetic characters in the string to their lower case counterparts.
Return: string
Usage: var result = s.toLower();
toUpper
Converts all alphabetic characters in the string to their upper case counterparts.
Return: string
Usage: var result = s.toUpper();
trim
Trims characters from the start and end of the string.
Signatures:
Return: string
Usage: var result = s.trim();
trimEnd
Trims characters from the end of the string.
Signatures:
Return: string
Usage: var result = s.trimEnd();
trimStart
Trims characters from the start of the string.
Signatures:
Return: string
Usage: var result = s.trimStart();
Indexers
-- No Indexers --