JavaScript String Methods

JavaScript String Methods

Methods Description

  1. charAt() It provides the char value present at the specified index.
  2. charCodeAt() It provides the Unicode value of a character present at the specified index.
  3. concat() It provides a combination of two or more strings.
  4. indexOf() It provides the position of a char value present in the given string.
  5. lastIndexOf() It provides the position of a char value present in the given string by searching a character from the last position.
  6. search()It searches a specified regular expression in a given string and returns its position if a match occurs.
  7. match() It searches a specified regular expression in a given string and returns that regular expression if a match occurs. 8. replace() It replaces a given string with the specified replacement.
  8. substr() It is used to fetch the part of the given string on the basis of the specified starting position and length. 10. substring() It is used to fetch the part of the given string on the basis of the specified index.
  9. slice() It is used to fetch the part of the given string. It allows us to assign positive as well negative index.
  10. toLowerCase() It converts the given string into lowercase letter.
  11. toLocaleLowerCase() It converts the given string into lowercase letter on the basis of host?s current locale.
  12. toUpperCase() It converts the given string into uppercase letter. 15. toLocaleUpperCase() It converts the given string into uppercase letter on the basis of host?s current locale. 16. toString() It provides a string representing the particular object.
  13. valueOf() It provides the primitive value of string object.
  14. split() It splits a string into substring array, then returns that newly created array.
  15. trim() It trims the white space from the left and right side of the string.