Members
trimEnd
The trimEnd() method removes whitespace from the end of a string. Whitespace in this context is all the whitespace characters (space, tab, no-break space, etc.) and all the line terminator characters (LF, CR, etc.).
- Source:
trimStart
The trimStart() method removes whitespace from the beginning of a string. Whitespace in this context is all the whitespace characters (space, tab, no-break space, etc.) and all the line terminator characters (LF, CR, etc.).
- Source:
Methods
(static) fromCodePoint() → {string}
Create a String from any number of codepoint values
- Source:
Returns:
The created string
- Type
- string
codePointAt(_position) → {number}
The codePointAt() method returns a non-negative integer that is the UTF-16 encoded code point value.
Parameters:
Name | Type | Description |
---|---|---|
_position |
number | The index at which the code point should be read |
- Source:
Returns:
The code point value, or undefined if _position is out of range.
- Type
- number
endsWith(_search, _limitopt) → {boolean}
Check if the string ends with the other string
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
_search |
string | The part to search for |
|
_limit |
number |
<optional> |
Optional: Search within this string as if this string were only this long; defaults to this string's actual length, clamped within the range established by this string's length. |
- Source:
Returns:
True if the string ends with search, false otherwise.
- Type
- boolean
includes(_search, _positionopt) → {boolean}
Check if the string includes the other string
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
_search |
string | The part to search for |
||
_position |
number |
<optional> |
0 | Optional: The index to start searching at. Defaults to 0. |
- Source:
Returns:
True if the string includes search, false otherwise.
- Type
- boolean
padEnd(_targetLength, _padStringopt)
The padEnd() method pads the current string with a given string (eventually repeated) so that the resulting string reaches a given length. The pad is applied from the end (right) of the current string.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
_targetLength |
number | The length of the resulting string once the current string has been padded. If this parameter is smaller than the current string's length, the current string will be returned as it is. |
||
_padString |
string |
<optional> |
" " | The string to pad the current string with. If this string is too long, it will be truncated and the left-most part will be applied. The default value for this parameter is " " (U+0020). |
- Source:
padStart(_targetLength, _padStringopt)
The padStart() method pads the current string with a given string (eventually repeated) so that the resulting string reaches a given length. The pad is applied from the start (left) of the current string.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
_targetLength |
number | The length of the resulting string once the current string has been padded. If this parameter is smaller than the current string's length, the current string will be returned as it is. |
||
_padString |
string |
<optional> |
" " | The string to pad the current string with. If this string is too long, it will be truncated and the left-most part will be applied. The default value for this parameter is " " (U+0020). |
- Source:
repeat(_count) → {string}
The repeat() method constructs and returns a new string which contains the specified number of copies of the string on which it was called, concatenated together.
Parameters:
Name | Type | Description |
---|---|---|
_count |
number | The amount of times to repeat the number. |
- Source:
Returns:
The string, repeated.
- Type
- string
startsWith(_search, _startopt) → {boolean}
Check if the string starts with the other string
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
_search |
string | The part to search for |
||
_start |
number |
<optional> |
0 | Optional: The position in this string at which to begin searching for _search; defaults to 0. |
- Source:
Returns:
True if the string starts with search, false otherwise.
- Type
- boolean
trim() → {string}
The trim() method removes whitespace from both ends of a string. Whitespace in this context is all the whitespace characters (space, tab, no-break space, etc.) and all the line terminator characters (LF, CR, etc.).
- Source:
Returns:
The trimmed string.
- Type
- string