ℹ️ NOTE: Depricated and removed features have been omitted from thsi documentation.
[toc]
String
String.prototype- Allows the addition of properties to aStringobject.
ℹ️ NOTE: Instance Properties are usually documented with
String.prototype.as a prefix. In order to save time, I have ommitted this.
-
constructor(read only) - Specifis the function that creates an object's prototype. -
length(read only) - returns an integer indicating the length of the string. -
N(read only) - Used to access the character in theNth position whereNis an integer between0andstr.length - 1.
String.fromCharCode(num[,...[numN]])- Returns a string created by using the specified sequence of Unicode values.String.fromCharPoint(num[,...[numN]])- Returns a string created by using the specified sequence of code points.String.raw()- Returns a string created from a raw template string.
ℹ️ NOTE: Instance Methods are usually documented with
String.prototype.as a prefix. In order to save time, I have ommitted this.Methods with the
⚠️ emoji indicate that it is not standardized. Documentation will only be provided if it is actually useful.
-
charAt(index)- Returns the character (exactly one UTF-16 code unit) at the specifiedindex. -
charCodeAt(index)- Returns a number that is the UTF-16 code unit at the specifiedindex. -
charCodePointAt(index)- Returns a nonnegative integerNumberthat is the code point value of the UTF-16 encoded code point starting at the specifiedindex. -
concat(str[, ...strN])- Combines the text of two (or more) strings and returns a new string. -
endsWith(searchString[, length])- Determines whether a string ends with the characters of the stringsearchString. -
includes(searchString[, position])- Determines wheter the calling string containssearchString. -
indexOf(searchValue[, fromIndex])- Returns the index within the callingStringobject of the first occurence ofsearchValue, or-1if not found. -
lastIndexOf(searchValue[, fromIndex])- Returns the index within the callingStringobject of the last occurence ofsearchValue, or-1if not found. -
localeCompare(compareString[, locales [, options]])- Returns a number indicating whether the reference stringcompareStringcomes before, after, or is equivalent to the given string in sort order. -
match(regexp)- Used to match regular expressionregexpagainst a string. -
matchAll(regexp)- Returns an iterator of all matches ofregexp. -
normalize([form])- Returns the Unicode Normalization Form of the calling string value. -
padEnd(targetLength[, padString])- Pads the current string from the end with a given string and returns a new string of the lengthtargetLength. -
padStart(targetLength[, padString])- Pads the current string from the start with a given string and returns a new string of the lengthtargetLength. -
repeat(count)- Returns a string consisting of the elements of the object repeatedcounttimes. -
replace(searchFor,replaceWith)- Used to replace occurrences ofsearchFor(which may be a string or regular expression) usingreplaceWith(which may be a string or a function). -
search(regexp)- Search for a match between a regular expressionregexpand the calling string. -
slice(beginIndex[, endIndex])- Extracts a section of a string and returns a new string. -
split([sep [,limit]])- Returns an array of strings populated by spliting the calling string at occurences of the substringsep. -
startsWith(searchString[, length])- Determines whether the calling string begins with the characters of stringsearchString. -
substring(beginIndex[, endIndex])- Returns a new string containing characters of the calling string from (or between) the specified index (or indeces). -
toLocaleLowerCase([locale, ...locales])- The characters within a string are converted to lowercase while respecting the current locale. For most languages, this will return the same astoLowerCase(). -
toLocaleUpperCase([locale, ...locales])- The characters within a string are converted to uppercase while respecting the current locale. For most languages, this will return the same astoUpperCase(). -
toLowerCase()- Returns the calling string value converted to lowercase. -
toSource()⚠️ - Returns an object literal representing the specified object; you can use this value to create a new object. Overrides theObject.prototype.toSource()method. -
toString()- Returns a string representing the specified object. Overrides theObject.prototype.toString()method.ℹ️ NOTE: When executing String conversion, It is possible to use
Stringas a more reliabletoString()alternative, as it works when used onnull,undefined, or onSymbols. -
toUpperCase()- Returns the calling string value converted to uppercase. -
trim()- Trims whitespace from the beginning and end of the string. -
trimEnd()(ortrimRight()) - Trims whitespace from the end of the string. -
trimStart()(ortrimLeft()) - Trims whitespace from the beginning of the string. -
valueOf()- Returns the primitive value of the specific object. Overrides theObject.prototype.valueOf()method. -
[@@iterator]()(or is it@@iterator()?) - Returns a newIteratorobject that iterates over the codepoint of a String value, returning each code point as a String value.
#JavaScriptReference