Common learning Java API Chapter XIII of

/*

Object class is the superclass, Java in this class are inherited directly or indirectly, all of the class

toString returns the contents of the current object, the type of Object class default operation, the object returned + @ + memory address value

equals compare two objects are equal content of the Object class default operation, the address value is compared

*/

 

 

/*

String string class, string constants can not be changed after creation

boolean equals (Object obj) determines the contents of the two strings are the same

boolean equalsIgnoreCase (String str) Analyzing the content of the two strings are the same, ignoring case

boolean contains (String str) determines whether the string, whether or not a given string comprising

boolean startsWith (String str) determines whether the string, whether the beginning of a given string

boolean endsWith (String str) determines whether the string, whether the end of the given string

boolean isEmpty () determines whether the string is empty string

int length () Get the length of the string

char charAt (int index) acquired on the character string specified position

String substring (int start) at the specified position, to the end of the end, the interception of the string, returns the new string

String substring (int start, int end) starting at the specified position to the end position specified, the interception of the string, returns the new string

 

int indexOf (int ch) obtaining a given string, the position of the first occurrence of the string

 

int indexOf (String str) obtaining a given string, the position of the first occurrence of the string

 

int indexOf (int ch, int fromIndex) starting at the specified location, access to a given character, the position of the first occurrence of the character

 

byte [] getBytes () to convert the string into a byte

 

char [] toCharArray () the string into character array

 

String replace (char old, char new) in the string, given the character of the old, replaced with a new character

 

String replace (String old, String new) in the string, the string given the old, replaced with a new string

 

String trim () remove the spaces at both ends of the string, the intermediate is not removed, it returns a new string

 

String toLowerCase () converts the string to a lowercase string

 

String toUpperCase () to convert the string to uppercase string

 

int indexOf (String str, int fromIndex) at the specified position, acquiring a given string, the position of the first occurrence of the string

 

*/

 

/*

StringBuffer and StringBuilder string buffer is a variable character sequences, commonly used in single-threaded StringBuilder, efficiency faster than StringBuffer

public StringBuffer append (String str) string buffer content in the original basis, at the end of additional content

public StringBuffer insert (int offset, String str) in the original string buffer based on the content , the new content is inserted at the designated location

public StringBuffer deleteCharAt (int index) in the original string buffer based on the content , delete the contents of the specified location

public StringBuffer delete (int start, int end) in the original string buffer based on the content , delete multiple content on a specified location

public StringBuffer replace (int start, int end, String str) content in the original string buffer based on the plurality of characters within a specified range, replacing the characters with a given

public StringBuffer reverse () the contents of the string buffer reversal  "abc" ---- "cba"

public String substring (int start) at the specified position, to the end of the end, the interception of the string buffer, and returns the new string

public String substring (int start, int end) starting at the specified position, to the specified end position, intercept the string buffer, and returns the new string

*/

Guess you like

Origin www.cnblogs.com/z97-/p/12650682.html
Recommended