Strings in TypeScript is divided in three parts:
This section has the details of following methods:
| toLocaleLowerCase | toLocaleUpperCase | toLowerCase |
| toUpperCase | toString | valueOf |
toLocaleLowerCase()
This method will convert all the characters of a string in lower case representing the current locale.
Syntax
string.toLocaleLowerCase();
Below is a sample code
var str1 = new String("I like to eat MANGOES, WHICH are YELLOW in color");
console.log("Original String: " + str1);
console.log("Lower-case String: " + str1.toLocaleLowerCase());
Below is the output of above code

toLocaleUpperCase()
This method will convert all the characters of a string in upper case representing the current locale.
Syntax
string.toLocaleUpperCase();
Below is a sample code
var str1 = new String("I like to eat MANGOES, WHICH are YELLOW in color");
console.log("Original String: " + str1);
console.log("Upper-case String: " + str1.toLocaleUpperCase());
Below is the output of above code

toLowerCase()
This method will convert all the characters of a string in lower case.
Syntax
string.toLowerCase();
Below is a sample code
var str1 = new String("I like to eat MANGOES, WHICH are YELLOW in color");
console.log("Original String: " + str1);
console.log("Lower-case String: " + str1.toLowerCase());
Below is the output of above code

toUpperCase()
This method will convert all the characters of a string in upper case.
Syntax
string.toUpperCase();
Below is a sample code
var str1 = new String("I like to eat MANGOES, WHICH are YELLOW in color");
console.log("Original String: " + str1);
console.log("Upper-case String: " + str1.toUpperCase());
Below is the output of above code

toString()
This method returns the string representing the specified object. You can perform all the string operations on this converted object.
Syntax
object.toString();
Below is a sample code
var str1 = "I like to eat MANGOES, WHICH are YELLOW in color";
console.log("Original String: " + str1);
console.log(str1.toString());
Below is the output of above code

valueOf()
This method returns the primitive value of the String Object.
Syntax
string.valueOf();
Below is a sample code
var str1 = "I like to eat MANGOES, WHICH are YELLOW in color";
console.log("Original String: " + str1);
console.log(str1.valueOf());
