Definition of string:
One: Initialize a String object directly with a string constant
Two: Initialize a newly created String object
Once a string object is created, its value cannot be changed, but it can be changed by reassigning other variables.
Sequence of questions:
String common methods:
Java String Class | Rookie Tutorial (runoob.com)
Java StringBuffer and StringBuilder classes | Rookie Tutorial (runoob.com)
Character.isLowerCase()
Character.isUpperCase(word.charAt(1))
word.charAt(0)
Character.isLetterOrDigit(ch)
new StringBuffer(sgood).reverse()
t.compareTo(res)
Classification of string topics:
character:
It is only required to examine the individual retrieval of the characters of the string, so it is required to master the basic method of traversing the characters of the string.
Palindrome string:
call the method directly
new StringBuffer(sgood).reverse()
Double pointer method judgment
public prefix:
Method 1: Horizontal scanning
Method 2: Vertical scanning
That is, the multi-pointer judgment method.
When scanning vertically, traverse each column of all character strings from front to back, and compare whether the characters on the same column are the same. If they are the same, continue to compare the next column. If they are not the same, the current column no longer belongs to the common prefix. part is the longest common prefix.
Method Three: Divide and Conquer
Recursive methods can be used to solve subproblems.
Method 4: binary search
word:
Judging by judging the spaces contained in the string
Reverse of the string:
Character statistics:
Use a hash table to record the frequency of each character
High-precision computing:
Add integers as strings:
Use the way of double pointer, add from the low bit, and give a carry flag whether there is a carry.
Multiply integers in string form:
String matches:
There are three common string matching algorithms (4 messages) String matching principle and implementation (C++ version)
For details, please refer to the introduction of the above link.