32. substring()

This method is used to get the new string from the original string. It takes the first index (inclusive) and the second index (exclusive). This is the same as the subSequence but this method returns String instead of CharSequence. If the second index is not provided, then the substring returns the string starting from the first index to the length of the original string.

33. toCharArray()

This method is used to convert the string into the character array.

34. toLowerCase()

This method is used to convert the string into lowercase.

35. toUpperCase()

This method is used to convert the string into uppercase.

36. toString()

This method is used to convert any object value into a string.

37. trim()

This method is used to trim the space before and after the string.

38. valueOf()

This method is used to convert the values into the string data type (same as the toString method). Since the toString method is not applicable for primitive data types we can use the valueOf method to convert primitive types into the string.


-A blog by Shwetali Khambe

Related Posts