Home > Web Front-end > JS Tutorial > body text

Summary of js letter case conversion implementation methods_javascript skills

WBOY
Release: 2016-05-16 17:15:54
Original
1578 people have browsed it

toLocaleUpperCase method

Returns a string in which all alphabetic characters have been converted to uppercase, adapting to the host environment's current locale.
stringVar.tolocaleUpperCase( )
The required stringVar reference is a String object, value or literal.

Description
The toLocaleUpperCase method converts characters in a string while adapting to the current locale of the host environment. In most cases, the result is the same as using the toUpperCase method. However, if the language rules conflict with regular Unicode case mapping, the results will be different.

toLocaleLowerCase method

Returns a string in which all alphabetic characters have been converted to lowercase, taking into account the current locale of the host environment.
stringVar.tolocaleLowerCase( )
The required stringVar reference is a String object, value or literal.

Description
The toLocaleLowerCase method converts characters in a string while adapting to the current locale of the host environment. In most cases, the result is the same as using the toLowerCase method. However, if the language rules conflict with regular Unicode case mapping, the results will be different.

toLowerCase method

Returns a string with the letters in the string converted to lowercase letters.
strVariable.toLowerCase( )
"String Literal".toLowerCase( )

Note
The toLowerCase method will not affect non-alphabetic characters.

The following example demonstrates the effect of the toLowerCase method:
var strVariable = "This is a STRING object";
strVariable = strVariable.toLowerCase( );

The value of strVariable after executing the previous statement is:
this is a string object

toUpperCase method

Returns a string with all letters in the string converted to uppercase letters.
strVariable.toUpperCase( )
"String Literal".toUpperCase( )

Note
The toUpperCase method will not affect non-alphabetic characters.

Example
The following example demonstrates the effect of the toUpperCase method:
var strVariable = "This is a STRING object";
strVariable = strVariable.toUpperCase( );

The value of strVariable after executing the previous statement is:
THIS IS A STRING OBJECT

Copy code The code is as follows :

function UpperFirstLetter(str)
{
return str.replace(//b/w /b/g, function(word) {
0,1).toUpperCase( )                                                     🎜>
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template