Skip to content

Latest commit

 

History

History
executable file
·
14 lines (10 loc) · 666 Bytes

File metadata and controls

executable file
·
14 lines (10 loc) · 666 Bytes

Similar to arrays, there are other string methods that you might want to know and use in the future. These methods are valueOf(), split(), trim(), trimLeft() and trimRight(). The syntax and the function of each methods is shown below.

string.valueOf()

  • returns the primitive value of the object string

string.split(separator)

  • splits the string by separator and returns an array of strings, containing the separated parts
  • separator can be a regular expression

string.trim()

  • removes whitespace from the beginning and end of the string

str.trimLeft(), str.trimRight()

  • remove whitespace from the left/right side of the string