**
* Function Description: converts all lowercase letters in a string to uppercase letters.
* Input parameter: string to be converted
* Output: uppercase letter string
* Example: function test_2 (){
* Var STR = "abcdefdsfasdfdsaf ";
* Var result = touppercase (STR );
* Alert (result );
*}
*/
Function touppercase (STR ){
VaR Regexp =/[A-Z]/g;
Return Str. Replace (Regexp, function (smatch ){
Switch (smatch ){
Case 'A ':{
Return "";
Break;
}
Case 'B ':{
Return "B ";
Break;
}
Case 'C ':{
Return "C ";
Break;
}
Case 'D ':{
Return "D ";
Break;
}
Case 'E ':{
Return "E ";
Break;
}
Case 'F ':{
Return "F ";
Break;
}
Case 'G ':{
Return "G ";
Break;
}
Case 'H ':{
Return "H ";
Break;
}
Case 'I ':{
Return "I ";
Break;
}
Case 'J ':{
Return "J ";
Break;
}
Case 'K ':{
Return "K ";
Break;
}
Case 'l ':{
Return "L ";
Break;
}
Case 'M ':{
Return "M ";
Break;
}
Case 'N ':{
Return "N ";
Break;
}
Case 'O ':{
Return "O ";
Break;
}
Case 'p ':{
Return "p ";
Break;
}
Case 'q ':{
Return "Q ";
Break;
}
Case 'r ':{
Return "R ";
Break;
}
Case's ':{
Return "S ";
Break;
}
Case 'T ':{
Return "T ";
Break;
}
Case 'U ':{
Return "U ";
Break;
}
Case 'V ':{
Return "v ";
Break;
}
Case 'W ':{
Return "W ";
Break;
}
Case 'X ':{
Return "X ";
Break;
}
Case 'y ':{
Return "Y ";
Break;
}
Case 'Z ':{
Return "Z ";
Break;
}
}
});
}
Tested JavaScript has built-in touppercase () and tolowercase () methods,
Ah, I didn't know how to use the built-in functions in the past. I tried to find implementation methods everywhere. This was collected from the Internet and is indeed available.