The following is a simple example of Python string case-sensitivity conversion. I think this is quite good. now I will share it with you and give you a reference. Let's take a look at the following small series to bring you a simple example of Python string case-sensitivity conversion. I think this is quite good. now I will share it with you and give you a reference. Let's take a look at it with Xiaobian.
① All letters are converted to uppercase letters.
#-*-Coding: UTF-8 -*-
If _ name _ = "_ main __":
A = 'Hello, world! '
Print (a. upper () output:
HELLO, WORLD!
② All letters are converted to lowercase letters
#-*-Coding: UTF-8 -*-
If _ name _ = "_ main __":
A = 'Hello, WORLD! '
Print (a. lower () output:
Hello, world!
③ The initial character is converted to uppercase and the remaining characters are converted to lowercase letters.
#-*-Coding: UTF-8 -*-
If _ name _ = "_ main __":
A = 'Hello, WORLD! '
Print (a. capitalize () output:
Hello, world!
④ The first letter of all words is converted into uppercase letters, and the other words are converted into lowercase letters.
#-*-Coding: UTF-8 -*-
If _ name _ = "_ main __":
A = 'Hello, WORLD! '
Print (a. title () output:
Hello, World!
⑤ Judge that all letters are in uppercase
#-*-Coding: UTF-8 -*-
If _ name _ = "_ main __":
A = 'Hello, WORLD! '
Print (a. isupper ())
B = 'Hello, world! '
Print (B. isupper () output:
True
False
6. all letters are lowercase.
#-*-Coding: UTF-8 -*-
If _ name _ = "_ main __":
A = 'Hello, WORLD! '
Print (a. islower ())
B = 'Hello, world! '
Print (B. islower () output:
False
True
7. determine that the first letter of all words is uppercase.
#-*-Coding: UTF-8 -*-
If _ name _ = "_ main __":
A = 'Hello, WORLD! '
Print (a. istitle ())
B = 'Hello, world! '
Print (B. istitle ())
C = 'Hello, World! '
Print (c. istitle () output:
False
False
True
The simple example of the above Python string case-sensitivity conversion is all the content that I have shared with you. I hope to give you a reference and support for PHP.
For more articles about simple Python string case-sensitivity conversion, refer to PHP!