Java StringBuffer&StringBuilder

Java StringBuffer and StringBuilder class

When the character string needs to be modified when using StringBuffer and StringBuilder class

The difference between StringBuffer and StringBuilder class

  • StringBuffer: speed, not thread safe
  • StringBuilder: slow, thread-safe

StringBuffer methods:

1, append (): appending the string

2, reverse (): Reverse

3, delete (start, end): Delete string

4, insert (index, string): insertion string

5, replace (start, end, str): replacement string

6, capacity (): returns the current capacity

7, getChars (): string interception

Like the rest of the String methods

Guess you like

Origin www.cnblogs.com/Mr-l/p/11875623.html