| new StringBuffer() | ใช้ในการสร้าง object StringBuffer โดย object นี้จะมีความยาวสูงสุดไม่เกิน 16 |
|---|---|
| new StringBuffer ( length ) | ใช้ในการสร้าง object StringBuffer โดย object นี้จะมีความยาวสูงสุดไม่เกิน length |
| new StringBuffer ( text ) | ใช้ในการสร้าง object StringBuffer โดย object นี้จะมีความยาวสูงสุดตามจำนวนตัวอักษรที่ได้สร้างไป |
| append() | ใช้ในการรวมข้อความ string |
| charAt() | ใช้ในการคืนค่าตัวอักษรของข้อความ string ณ ตำแหน่งที่กำหนด |
| setCharAt() | ใช้ในการแทนที่ตัวอักษร ลงในข้อความ string |
| length() | ใช้ในการคืนค่าจำนวนตัวอักษรของข้อความ string |
| setLength() | ใช้กำหนด ความยาว สูงสุดของ ข้อความ string |
| capacity() | ใช้ในการคืนค่าความยาวสูงสุดของข้อความ string |
| insert() | ใช้แทรกข้อความ string ลงไป โดยแทรกในตำแหน่ง start |
| reverse() | ใช้สลับข้อความ string จากหลังไปหน้า จากหน้าไปหลัง |
method:new StringBuffer ();
return type:StringBuffer
content:ใช้ในการสร้าง object StringBuffer โดย object นี้จะมีความยาวสูงสุดไม่เกิน 16
example:StringBuffer str_buff = new StringBuffer();
method:new StringBuffer ( length );
return type:StringBuffer
content:ใช้ในการสร้าง object StringBuffer โดย object นี้จะมีความยาวสูงสุดไม่เกิน length
example:StringBuffer str_buff = new StringBuffer( 30 );
method:new StringBuffer ( text );
return type:StringBuffer
content:ใช้ในการสร้าง object StringBuffer โดย object นี้จะมีความยาวสูงสุดตามจำนวนตัวอักษรที่ได้สร้างไป
example:StringBuffer str_buff = new StringBuffer( "bamboolabcode" );
method:append ( object_string_buffer );
return type:void
content:ใช้ในการรวมข้อความ string
example:StringBuffer str_buff_1 = new StringBuffer( "bamboo" ); StringBuffer str_buff_2 = new StringBuffer( "labcode" ); str_buff_1.append( str_buff_2 );
method:charAt ( index );
return type:char
content:ใช้ในการคืนค่าตัวอักษรของข้อความ string ณ ตำแหน่งที่กำหนด
example:StringBuffer str_buff = new StringBuffer( "bamboo" ); char char_text = str_buff.charAt( 2 );
method:setCharAt ( index, char_text );
return type:void
content:ใช้ในการแทนที่ตัวอักษร ลงในข้อความ string
example:StringBuffer str_buff = new StringBuffer( "bomboo" ); str_buff.setCharAt ( 1, 'a' );
method:length ();
return type:int
content:ใช้ในการคืนค่าจำนวนตัวอักษรของข้อความ string
example:StringBuffer str_buff = new StringBuffer( "bamboolabcode" ); int num = str_buff.length();
method:setLength ( max );
return type:void
content:ใช้กำหนด ความยาว สูงสุดของ ข้อความ string
example:StringBuffer str_buff = new StringBuffer ( ); str_buff.setLength( 10 );
method:capacity ();
return type:int
content:ใช้ในการคืนค่าความยาวสูงสุดของข้อความ string
example:StringBuffer str_buff = new StringBuffer ( 20 ); int max = str_buff.capacity();
method:insert ( start, text );
return type:void
content:ใช้แทรกข้อความ string ลงไป โดยแทรกในตำแหน่ง start
example:StringBuffer str_buff = new StringBuffer ( bamlabcode ); str_buff.insert ( 3, "boo" );
method:reverse ();
return type:void
content:ใช้สลับข้อความ string จากหลังไปหน้า จากหน้าไปหลัง
example:StringBuffer str_buff = new StringBuffer ( bamlabcode ); str_buff.reverse();