. 1 StringBuffer class:
2 string object may be modified to create StringBuffer class, String object can not be modified to create
3 constructor: StringBuffer () = StringBuffer new new StringBuffer ();
. 4 StringBuffer (); // default initial hold 16 characters
. 5 StringBuffer ( int size);
. 6 the StringBuffer (String S);
. 7
. 8 stringbuffer.length (); method to get the length of the sequence of characters stored in the entity -> initial default is 0
. 9 stringbuffer.capacity (); a method of acquiring an actual current entity capacity -> initial default 16
10
. 11 the StringBuffer common methods:
12 calls .append () method can
13 is the StringBuffer the append (String S); //Added to the back of the string s StringBuffer StringBuffer object and return the object reference
14 StringBuffer the append ( int n-); // converted to type int word string is then added StringBuffer object
15 StringBuffer the append (Object Object ); // a string object StringBuffer object is added to the object
16 StringBuffer the append ( Long . 17 StringBuffer the append (n-Boolean);
18 is StringBuffer the append ( a float n-);
. 19 StringBuffer the append ( Double n-);
20 is StringBuffer the append ( char C);
21 is public char the charAt ( int index);// single character index parameter to obtain specified position
22 is public void setCharAt ( int index, char CH); // string is replaced with the string at index CH
23 is the StringBuffer INSERT ( int index, String STR); // The string str inserted position index
24 public the StringBuffer Reverse (); // string flipping
25 the StringBuffer delete ( int Start, int End); // remove from start-> end-1 of this section of the string
26 is the StringBuffer Replace ( int Start, int End, String str); //The replacement string string str [start, end-1] of this interval