Example of getting started with the toLowerCase method of a JavaScript string object (used to convert letters to lowercase) and javascript to lowercase
JavaScript toLowerCase Method
The toLowerCase method is used to convert a (English) string to lowercase and return the converted string. The syntax is as follows:
Copy codeThe Code is as follows:
Str_object.toLowerCase ()
ToLowerCase method example
Copy codeThe Code is as follows:
<Script language = "JavaScript">
Var str = "AaBbCc ";
Alert (str. toLowerCase ());
</Script>
Run this example. The output in the pop-up prompt box is aabbcc.
ToLocaleLowerCase Method
The toLocaleLowerCase method is basically the same as the toLowerCase method. toLocaleLowerCase converts the string to lowercase in a local way. Only a few languages (such as Turkish) have local-specific case ing.
In javascript, the string object uses tolowercase () to convert the string to lowercase. The string itself will change, or it will remain the same as java.
Same as java
In JavaScript, how can I convert uppercase letters in strings to lowercase letters and convert lowercase letters to uppercase letters?
Example:
Function funZhuanHuanDaXiaoXie (str)
{
Var ar = str. split ('');
For (var I = 0; I <ar. length; I ++)
{
If (ar [I]. charCodeAt (0)> = 65 & ar [I]. charCodeAt (0) <= 90)
{
Ar [I]. toLowerCase ();
}
Else
{
Ar [I]. toUpperCase ();
}
} // All conversions have been made here;
Str = "";
For (var I = 0; I <ar. length; I ++)
{
Str + = ar [I];
}
Reture str;
}
The landlord can use the method I wrote to convert it, for example:
Var text = "IUHIUUskuisudin ";
Call this method conversion (you can set the method name as you like ):
Text = funZhuanHuanDaXiaoXie (text );