Public class num {
Public static void main (string args []) {
// ============================ String =========================================================================================================================================================================================================== ================
CHAR Chars [] = {65, 66, 67, 68, 69};
// Partial initialization
// string s = new string (chars, 2, 3);
/ / Construct a String object for initialization
// String b = new string (s);
// Code automatic conversion
String E = New String (Chars);
// String length
System.out.println (E.LENGTH ());
//System.out.print(b);
/ / String connection: The output of the output will automatically call the TOSTRING method
// Charat (int NUM) of the string;
/ * Part of the string intercept GetChars (int Sourcestart, int Source (-1), char target [], int targetstart)
* getBytes (int Sourcestart, int Source (-1), byte target [], int targetStart)
* char [] TOCHARARRAY (): Transforming to a Char array. Equal to getchars ();
* /
String a = "ni shi shei a";
String b [] = new string [4];
a.tochararray ();
System.out.println (a);
/ * --------------- String Comparison ----------------------------- ---------
* Boolean Equals (Obj J) and Boolean EqualsignoreCase (Obj J)
* == must be the same object
*
* Boolean RegionMatches (int Start1Index, StRING ST2, INT Start2Index, Int Num); ignore the case of Boolean RegionMatches (Boolean Ignorecase, Int StartIndex, String St2, Int Start2Index, Int Num);
* Compares from St1 Start1Index to NUM and ST2 START2Index to NUM
*
* Boolean StartSwith (String Str) STR is his start
* Boolean Endswith (String Str) STR is his end
*
* int CoMPareto (String Str) int COMPAREToIGNORECASE (String STR)
* Small than 0 call strings less than STR
* Great than 0 call strings are greater than STR
* Equal to 0 call strings equal to STR
* /
String a1 = "ac";
String b1 = "c";
System.out.println (A1.Compareto (B1));
/ * -------- Search string --------- * int indexof (int CH INT LastIndexof (int CH) in the first appearance of the first time in the compared field
* int indexof (String Ch) Int LastIndexof (String Ch)
* int indexof (int CH, IndexStart) int LastIndexof (int CH, IndexStart)
* int indexof (string ch, indexstart) int LastIndexof (String Ch, IndexStart)
* /
System.out.println (a1.indexof (b1));
/ * ------------- Modify string -----------
* String Substr (int start, [int end]);
* String Replace ('alternative characters', 'alternative characters')
* String Trim () Delete before and after blank
* /
/ * ------------ Valueof () achieves data transformation -------
*
* /
/ * ----------- Size ------------
* String tolowercase ();
* String Touppercase ();
* /
/ / ============================= StringBuffer =================== ==========
/ *
* StringBuffer ()
* StringBuffer (int size)
* StringBuffer (String STR)
* /
/ *
* int lengrh () size int Capacity () capacity
*
* Void EnSureCapacity (int Capacity) pre-allocation capacity
*
* Void SetLength Set the buffer size
*
* CHAR Charat (int where) Get void setcharat (int where, char ch) replacement
*
* void getchars (int Sourcestart, int Source, char target [], int targetstart)
*
* StringBuffer append (string str); stringbuffer append (object str); StringBuffer Append (int STR);
*
* StringBuffer Insert (int index, string str); StringBuffer INSERT (int index, object str); StringBuffer Insert (int index, int STR); inserted into index *
* StringBuffer Reverse () flip
*
* StringBuffer Delete (int StartIndex, Int endindex-1); StringBuffer deletecharat (int Loc);
*
* StringBuffer Replace (int indexstart, int indexend, string STR);
*
* String subString (int indexstart); String Substring (int indexend);
* /
}
}