String API

The String global object is a constructor for strings or a sequence of characters.

42 Total 40 Methods 2 Properties 5 Statics
  Show all

String(…)

Coerces the argument to a string.String([value])

[Symbol.Iterator]()

The iterator property returns the default iterator for String objects.s[Symbol.Iterator]()

at()

Returns the character at the specified index, allowing for positive and negative integers.s.at()

charAt()

Returns the character at the specified index.s.charAt()

charCodeAt()

Returns the Unicode value of the character at the specified index.s.charCodeAt()

codePointAt()

Returns the Unicode code point value of the character at the specified index.s.codePointAt()

concat()

Joins two or more strings and returns a new string.s.concat()

constructor()

Creates a new String object. Called when creating a string using the String() constructor. (NOTE: `.constructor === String` and `String.constructor === Function.prototype.constructor`)s.constructor()

endsWith()

Determines whether a string ends with the characters of a specified string.s.endsWith()

String.fromCharCode()

Returns a string created from the specified sequence of UTF-16 code units.String.fromCharCode()

String.fromCodePoint()

Returns a string created from the specified sequence of code points.String.fromCodePoint()

includes()

Determines whether a string contains the characters of a specified string.s.includes()

indexOf()

Returns the index of the first occurrence of a specified value in a string.s.indexOf()

isWellFormed()

Checks if a string contains valid UTF-16 code units.s.isWellFormed()

lastIndexOf()

Returns the index of the last occurrence of a specified value in a string.s.lastIndexOf()

length

The length property returns the length of a string.s.length

localeCompare()

Returns a number indicating whether a reference string comes before, after, or is equivalent to a given string in sort order.s.localeCompare()

match()

Retrieves the matches of a string against a regular expression.s.match()

matchAll()

Returns an iterator of all matches of a string against a regular expression.s.matchAll()

normalize()

Returns the Unicode Normalization Form of the string.s.normalize()

padEnd()

Pads the end of a string with a specified string to a specified length.s.padEnd()

padStart()

Pads the start of a string with a specified string to a specified length.s.padStart()

String.prototype

The initial value of String.prototype is the String prototype object. This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }.String.prototype

String.raw()

Returns a string created from a raw template string.String.raw()

repeat()

Returns a new string which contains the specified number of copies of the original string.s.repeat()

replace()

Returns a new string with some or all matches of a pattern replaced by a replacement.s.replace()

replaceAll()

Returns a new string with all matches of a pattern replaced by a replacement.s.replaceAll()

search()

Executes a search for a match between a regular expression and this string.s.search()

slice()

Extracts a section of a string and returns it as a new string.s.slice()

split()

Splits a string into an array of substrings using a specified separator.s.split()

startsWith()

Determines whether a string begins with the characters of a specified string.s.startsWith()

substring()

Returns a subset of a string between one index and another, or to the end of the string.s.substring()

toLocaleLowerCase()

Returns a string with all alphabetic characters converted to lowercase, respecting the host environment's locale.s.toLocaleLowerCase()

toLocaleUpperCase()

Returns a string with all alphabetic characters converted to uppercase, respecting the host environment's locale.s.toLocaleUpperCase()

toLowerCase()

Returns a string with all alphabetic characters converted to lowercase.s.toLowerCase()

toString()

Returns a string representing the specified object.s.toString()

toUpperCase()

Returns a string with all alphabetic characters converted to uppercase.s.toUpperCase()

toWellFormed()

Returns a string where all lone surrogates of this string are replaced with the Unicode replacement character.s.toWellFormed()

trim()

Removes whitespace from both ends of a string.s.trim()

trimEnd()

Removes whitespace from the end of a string.s.trimEnd()

trimStart()

Removes whitespace from the beginning of a string.s.trimStart()

valueOf()

Returns the primitive value of a String object.s.valueOf()

constructor()

method

Creates a new String object. Called when creating a string using the String() constructor. (NOTE: `.constructor === String` and `String.constructor === Function.prototype.constructor`) s.constructor()

You seem to be offline. App may not work.