touppercase_JavaScript中的String toUpperCase()方法与示例

news/2024/7/19 12:49:53 标签: 字符串, java, python, javascript, js

touppercase

字符串toUpperCase()方法 (String toUpperCase() Method)

toUpperCase() Method is a string method in JavaScript, it is used to converts all alphabets in uppercase and returns the new string with uppercase alphabets.

toUpperCase()方法是JavaScript中的字符串方法,用于转换所有大写字母并返回带有大写字母的新字符串

Syntax:

句法:

    new_string = str.toUpperCase();

Here,

这里,

  • str is the main string to be converted.

    str是要转换的主字符串

  • new_string is the returned new string with all alphabets in uppercase.

    new_string是返回的新字符串,所有字母均大写。

Examples:

例子:

    Input: "Hello World!"
    Output: "HELLO WORLD!"
    Input: "[email protected]"
    Output: "[email protected]"

Code:

码:

<html>
<head>
<title>JavaScipt Example</title>
</head>

<body>
<script>		
	var main_str = "Hello World!";
	var new_str = main_str.toUpperCase();
	document.write("main_str =  " + main_str + "<br>");
	document.write("new_str =  " + new_str + "<br>");

	main_str = "[email protected]";
	new_str = main_str.toUpperCase();
	document.write("main_str =  " + main_str + "<br>");
	document.write("new_str =  " + new_str + "<br>");	
</script>
</body>
</html>

Output

输出量

main_str = Hello World!
new_str = HELLO WORLD!
main_str = [email protected]
new_str = [email protected]


翻译自: https://www.includehelp.com/code-snippets/string-toUpperCase-method-with-example-in-javascript.aspx

touppercase


http://www.niftyadmin.cn/n/1256307.html

相关文章

PCIe调试心得_DMA part2

作者&#xff1a;East FPGA那点事儿 上一章讲述了PCIe总线DMA的原理和XAPP1052存在的问题。 本章以服务器常用的4通道1000M以太网卡为例讲述如何提高DMA的效率。 1.内存重分配Windows操作系统会划分一部分硬盘空间作为虚拟内存&#xff0c;将长时间不用得应用程序或内存交换到…

麦吉尔电子计算机工程专业好么,多大/UBC/麦吉尔,什么专业最厉害?

还记得&#xff0c;前几天QS一口气发的重磅排名&#xff1a;5大领域&#xff0c;具体到48个专业&#xff0c;全球大学哪家强吗&#xff1f;大家关注度最多的当然也还是加国的三大名校&#xff1a;多大、UBC、麦吉尔。所以&#xff0c;今天就来扒一扒&#xff0c;QS专业排名中&a…

like匹配使用的通配符_使用动态编程(DP)的通配符匹配问题

like匹配使用的通配符Problem: You are given two strings (one query and other pattern). You have to find whether the pattern matches to query or not. Print 1 if matches otherwise 0. Some rules for matching: 问题&#xff1a;给您两个字符串(一个查询和另一种模式…

c#异常处理_C#异常处理能力问题和解答 套装5

c#异常处理1) Is it mandatory to use finally block with try and catch? YesNo Answer & Explanation Correct answer: 2No No, it is optional. 1)是否必须在try and catch中使用finally块&#xff1f; 是 没有 答案与解释 正确答案&#xff1a;2 没有 不&#xff…

内蒙古师范大学计算机科学专业,内蒙古师范大学计算机科学与技术怎么样

内蒙古师范大学计算机科学与技术怎么样&#xff1f;我们可以从以下几个方面来判断内蒙古师范大学计算机科学与技术怎么样&#xff1a;第一&#xff1a;内蒙古师范大学计算机科学与技术全国综合排名&#xff0c;根据浙内蒙古师范大学计算机科学与技术学科实力、教师水平、科研成…

[Python Study Notes]文件操作

文件操作 对文件操作流程 打开文件&#xff0c;可添加filepath打开某绝对路径下的文件&#xff0c;得到文件句柄并赋值给一个变量通过句柄对文件进行操作关闭文件1 # The_author liu662 # -*- coding utf-8 -*-3 4 filepathD:\学习资料\ehmatthes-pcc-6bfeca0\chapter_10…

c#异常处理_C#异常处理能力问题和解答 套装3

c#异常处理1) How many times can we use to try block in a C# program? 5 times2 timesAny number of timesOnly one time Answer & Explanation Correct answer: 3Any number of times We can use try block any number of times in a c# program. 1)我们可以使用多少次…

osi模型的物理层上运行_物理层在OSI模型中的功能| 计算机网络

osi模型的物理层上运行什么是物理层&#xff1f; (What is Physical Layer?) The physical layer consists of all the functions required to transmit a bitstream over a Physical medium. The electrical and mechanical specifications of the interface and transmissio…