String class works with strings and text.
A JavaScript string stores a series of characters like "test".
A string can be any text inside double or single quotes:
String indexes are zero-based: the first character is in position 0, the second in 1, and so on.
Property | Description |
String constructor Property | In JavaScript, the constructor property returns the constructor function for an object. |
String length Property | The length property returns the length of a string (number of characters). |
Method | Description |
String anchor() Method | The anchor() method creates an HTML anchor. This method returns the string embedded in the <a> tag, like this: |
String big() Method | The big() method displays a string in a big font. This method returns the string embedded in the <big> tag, like this: |
String blink() Method | The blink() method displays a blinking string. This method returns the string embedded in the <blink> tag, like this: |
String bold() Method | The bold() method is used to display a string in bold. This method returns the string embedded in the <b> tag, like this: |
String charAt() Method | The charAt() method returns the character at the specified index from a string. |
String charCodeAt() Method | The charCodeAt() method returns the Unicode of the character at the specified index in a string. |
String concat() Method | The concat() method can join two or more strings together. |
String endsWith() Method | The endsWith() method determines whether a string ends with a specified string. |
String fixed() Method | The fixed() method can display a string as teletype text. |
String fontcolor() Method | The fontcolor() method can display a string in a specified color. |
String fontsize() Method | The fontsize() method can display a string in a specified size. |
String fromCharCode() Method | The fromCharCode() method converts Unicode values into characters. |
String includes() Method | The includes() method determines whether a string contains the characters of a specified string. |
String indexOf() Method | The indexOf() method returns the position of the first occurrence of a specified value in a string. |
String italics() Method | The italics() method is used to display a string in italic. |
String lastIndexOf() Method | The lastIndexOf() method returns the position of the last occurrence of a specified value in a string. |
String link() Method | The link() method is used to display a string as a hyperlink. |
String localeCompare() Method | The localeCompare() method compares two strings using the current locale. |
String match() Method | The match() method matches a string against a regular expression, and returns the matches, as an Array object. |
String repeat() Method | The repeat() method returns a new string with a specified number of copies. |
String replace() Method | The replace() method matches a string for a specified value, or a regular expression, and returns a new string whose the values are replaced. |
String search() Method | The search() method searches a string for a specified value, and returns the matched position. |
String slice() Method | The slice() method extracts parts of a string and returns the extracted parts as new string. |
String small() Method | The small() method is used to display a string in a small font. |
String split() Method | The split() method can split a string into an array of substrings. |
String startsWith() Method | The startsWith() method checks if a string begins with the specified string. |
String strike() Method | The strike() method displays a string that is struck out. |
String sub() Method | The sub() method displays a string as subscript text. |
String substr() Method | The substr() method returns parts of a string, beginning at the specified position, and returns the specified number of characters. |
String substring() Method | The substring() method extracts the characters from a string, between two specified indices, and returns the new sub string. |
String sup() Method | The sup() method is used to display a string as superscript text. |
String toLocaleLowerCase() Method | The toLocaleLowerCase() method converts a string to lowercase letters, according to the host's current locale. |
String toLocaleUpperCase() Method | The toLocaleUpperCase() method converts a string to uppercase letters, according to the host's current locale. |
String toLowerCase() Method | The toLowerCase() method converts a string to lowercase letters. |
String toString() Method | The toString() method returns the value of a String object. |
String toUpperCase() Method | The toUpperCase() method converts a string to uppercase letters. |
String trim() Method | The trim() method removes whitespace from both sides of a string. |
String valueOf() method | The valueOf() method returns the primitive value of a String object. |