用法: string.toUpperCase() string:要转换为大写的字符串。 例子:在这里,toUpperCase()方法被调用str字符串,将所有小写字母转换为大写。得到的字符串,"HELLO WORLD", 被赋值给变量upperStr. Javascript conststr ="hello world";constupperStr = str.toUpperCase();console.log(upperStr);// Output: "HELLO WORL...
To convert a string to uppercase, we can use the built-in method in JavaScript. Here is an example that converts a string to uppercase…
JavaScript // JavaScript StringtoUpperCase() method// to convert string to Uppercasefunctionfunc(){// Original stringletstr ='It iS a 5r&:ampe@@t Day.'// String converted to Upper Caseletstring = str.toUpperCase();console.log(string); } func(); 输出: IT IS A 5R&:AMPE@@T DAY. ...
The toUpperCase() method returns the string converted to uppercase. Example const message = "javascript is fun"; // convert message to uppercase const upperMessage = message.toUpperCase(); console.log(upperMessage); // Output: JAVASCRIPT IS FUN Run Code toUpperCase() Syntax The syntax of ...
一般语言的字符集比如GBK,UTF-8等,包含的特殊字符集是和标准的ASCII码一致的。 但有一些特殊语言的字符集,比如土耳其语,对应的特殊字符集就跟我们的不一样,它的A不是了,也不是67了,用toUpperCase()就不行了,需要用toLocalUpperCase(),一般情况下使用效果是一样的。
ThetoUpperCase()method converts a string to uppercase letters. ThetoUpperCase()method does not change the original string. See Also: The toLowerCase() Method The toLocaleLowerCase() Method The toLocaleUpperCase() Method Syntax string.toUpperCase() ...
This JavaScript tutorial explains how to use the string method called toUpperCase() with syntax and examples. In JavaScript, toUpperCase() is a string method that is used to convert a string to uppercase.
write("String str = ", str); document.write("After converting a specific character '", str.charAt(9), "' into in uppercase: "); document.write(str.charAt(9).toUpperCase()); OutputThe above program converts a specific character 'p' to a uppercase.String str = Tutorialspoint After...
In an earlier article, we looked at different ways to capitalize the first letter of a string to uppercase in JavaScript. In this article, you'll learn how to uppercase or lowercase a string using JavaScript. JavaScript provides two built-in functions for converting strings to uppercase and ...
JavaScript provides several built-in methods for manipulating strings, including one called toUpperCase() which can be used to convert the first letter of a string to uppercase.