les fonctions string en javascript
Voici un classement par type de retours des fonctions applicables aux chaines de caractères
Tableau de strings
match()
: regex Searches a string for a match against a regular expression, and returns the matchessplit()
: Splits a string into an array of substrings
Booléens
endsWith()
: Checks whether a string ends with specified string/charactersincludes()
: Checks whether a string contains the specified string/characterslocaleCompare()
: Compares two strings in the current localestartsWith()
: Checks whether a string begins with specified characters
Caractères
substring()
: Extracts the characters from a string, between two specified indicessubstr()
: Extracts the characters from a string, beginning at a specified start position, and through the specified number of characterfromCharCode()
: Converts Unicode values to characters
Position
indexOf()
: Returns the position of the first found occurrence of a specified value in a stringlastIndexOf()
: Returns the position of the last found occurrence of a specified value in a stringsearch()
: Searches a string for a specified value, or regular expression, and returns the position of the matchcharCodeAt()
: Returns the Unicode of the character at the specified indexcharAt()
: Returns the character at the specified index (position)
Manipulation de chaines de caractère
concat()
: Joins two or more strings, and returns a new joined stringsrepeat()
: Returns a new string with a specified number of copies of an existing stringreplace()
: Searches a string for a specified value, or a regular expression, and returns a new string where the specified values are replacedslice()
: Extracts a part of a string and returns a new stringtoLocaleLowerCase()
: Converts a string to lowercase letters, according to the host's localetoLocaleUpperCase()
: Converts a string to uppercase letters, according to the host's localetoLowerCase()
: Converts a string to lowercase letterstoString()
: Returns the value of a String objecttoUpperCase()
: Converts a string to uppercase letterstrim()
: Removes whitespace from both ends of a string
Casting
valueOf()
: Returns the primitive value of a String object
javascript
es6
tutoriel
string
programmation
rédigé le 06/10/16, mis à jour le 11/10/22 par Behrouze