In some situations, we need to convert our string, into lower case, and in such situations, there is a method, called as toLowerCase, for our help. As the name of the method says, the toLowerCase method is going to convert the string into lower case. Remember that this method is going to return a new string, which is the lowercase version of the given string, but the original string is going to be as it was.
Now, let’s have a look at an example, which makes our idea clear, about the toLowerCase method.
As you can see, in the above program, we have a string, and we are calling the method to lowercase, on the given string. Now, the toLowerCase method is going to return the string in the lowercase. But the thing is that the original string is going to be as it was. Let’s have a look at the output now –
As you can see, the first string is from the toLowerCase method, which is converted into the lower case, and then another string is the original string, which is there as it was. So, we can use the toLowerCase method, if you need to convert the string to lower case. This method can be used as required.