This blog is mainly to summarize our common development process in the string of some operations:# Letter Case Conversion # first letter to uppercase # remove special characters from string (e.g. ' _ ', '. ', ', ', '; ') and then concatenate the
The capitalize () method in which the first letter of a word is capitalized in Python, and pythoncapitalize
The capitalize () method returns a copy of the string, only the first letter of which is capitalized. For 8-bit strings, this method is
This article mainly introduces the capitalize () method of the first letter of the word in Python, which is the basic knowledge in the introduction of Python, and the friends who need it can refer to
The capitalize () method returns a copy of the
This article mainly describes how to capitalize the first letter of each word in a string, and you need a friend to refer to theIn a string, each word is separated by a space and the number of spaces is not limited to the following code: function
The capitalize () method returns a copy of the string, with only its first letter capitalized. For a 8-bit string, this method is related to the locale.
Grammar
The following is the syntax for the Capitalize () method:
Str.capitalize ()
1 str = input ('input a string ' need to change:')23 New _list = Str.split (")4 for in new_list: 5 print(I.capitalize (), end=" )When I learned the string split usage today, I suddenly thought of the front str.capitalize () capitalize the
In a string, each word is separated by a space and the number of spaces is not limited
Copy Code code as follows:
Function capitalize (Sting) {
var words = String.Split ("");
for (var i = 0; i Words[i] = Words[i].charat (0). toUpperCase (
Title Description:
For all words in a string, if the first letter of the word is not an uppercase letter, the first letter of the word becomes uppercase.In the string, the words are separated by a white space character, including a
Recently downloaded a lot of English lyrics (LRC format), found that many of the lyrics are lowercase, and the first letter of the sentence is not capitalized, although said nothing serious, but for the pursuit of perfection I, is also a big regret.
public class Firstletteruppercase {public static void main (string[] args) {System.out.println (New Firstletteruppercase ( ). Upperfirstlatter ("letter")); System.out.println (New Firstletteruppercase (). UpperFirstLatter2 ("letter"));
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.