ES6 - Strings
Use the following syntax to create a String object.
var val = new String(string);
The string parameter is a series of characters that has been properly encoded. String.
Following is a list of the properties of String object and its description.
|Sr.No||Property & Description|
Returns a reference to the String function that created the object .
Returns the length of the string.
The prototype property allows you to add properties and methods to an object .
Here is a list of the methods available in String object along with their description.
|Sr.No||Method & Description|
Returns the character at the specified index.
Returns a number indicating the Unicode value of the character at the given index.
Combines the text of two strings and returns a new string.
Returns the index within the calling String object of the first occurrence of the specified value, or -1 if not found.
Returns the index within the calling String object of the last occurrence of the specified value, or -1 if not found.
Returns a number indicating whether a reference string comes before or after or is the same as the given string in a sorted order.
Used to match a regular expression against a string.
Used to find a match between a regular expression and a string, and to replace the matched substring with a new substring.
Executes the search for a match between a regular expression and a specified string.
Extracts a section of a string and returns a new string.
Splits a String object into an array of strings by separating the string into substrings.
Returns the characters in a string beginning at the specified location through the specified number of characters.
Returns the characters in a string between two indexes into the string.
The characters within a string are converted to lower case while respecting the current locale.
The characters within a string are converted to uppercase while respecting the current locale.
Returns the calling string value converted to lowercase.
Returns a string representing the specified object.
Returns the calling string value converted to uppercase.
Returns the primitive value of the specified object.