12-02 Java string class

String construction method

Characteristics of string: once assigned, it cannot be changed.

But references can change

Illustration:

String s = new string ("hello") and string s = "hello"; What's the difference?

The difference between a string literal object and an object created by a constructor

Illustration:

Judgment function of string class:

String class judgment function - use the keyboard to enter guessing games

Get function of string class

String traversal:

Count the number of uppercase letters, lowercase letters and numbers in the string

String conversion function:

Convert the first letter of a string to uppercase and the rest to lowercase. (only English uppercase and lowercase characters are considered)

String类的其他功能:
替换功能:
去除字符串两空格  
按字典顺序比较两个字符串  

CompareTo source code analysis

Concatenate the data in the array into a string according to the specified format

String inversion

Count the number of occurrences of large and small strings

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>