waba.lang
Class StringBuffer

waba.lang.Object
  |
  +--waba.lang.StringBuffer

public class StringBuffer
extends Object

StringBuffer is an array of strings.

This class is used in code such as:

 String s = "Number: " + i + " Name: " + s;
 
to concatenate multiple strings together. In the code shown, the compiler generates references to the StringBuffer class to append the objects together.

As with all classes in the waba.lang package, you can't reference the StringBuffer class using the full specifier of waba.lang.StringBuffer. The waba.lang package is implicitly imported. Instead, you should simply access the StringBuffer like this:

 StringBuffer sb = new StringBuffer(s);
 


Constructor Summary
StringBuffer()
          Constructs an empty string buffer.
StringBuffer(String s)
          Constructs a string buffer containing the given string.
 
Method Summary
 StringBuffer append(boolean b)
          Constructs a string buffer containing the string representation of the given boolean value.
 StringBuffer append(char c)
          Constructs a string buffer containing the string representation of the given char value.
 StringBuffer append(char[] c)
          Appends the given character array as a string to the string buffer.
 StringBuffer append(float f)
          Constructs a string buffer containing the string representation of the given float value.
 StringBuffer append(int i)
          Constructs a string buffer containing the string representation of the given int value.
 StringBuffer append(Object obj)
          Appends the string representation of the given object to the string buffer.
 StringBuffer append(String s)
          Appends the given string to the string buffer.
 void setLength(int zero)
          Empties the StringBuffer and clears out its contents so it may be reused.
 String toString()
          Converts the string buffer to its string representation.
 

Constructor Detail

StringBuffer

public StringBuffer()
Constructs an empty string buffer.

StringBuffer

public StringBuffer(String s)
Constructs a string buffer containing the given string.
Method Detail

append

public StringBuffer append(boolean b)
Constructs a string buffer containing the string representation of the given boolean value.
See Also:
Convert

append

public StringBuffer append(char c)
Constructs a string buffer containing the string representation of the given char value.
See Also:
Convert

append

public StringBuffer append(int i)
Constructs a string buffer containing the string representation of the given int value.
See Also:
Convert

append

public StringBuffer append(float f)
Constructs a string buffer containing the string representation of the given float value.
See Also:
Convert

append

public StringBuffer append(char[] c)
Appends the given character array as a string to the string buffer.

append

public StringBuffer append(String s)
Appends the given string to the string buffer.

append

public StringBuffer append(Object obj)
Appends the string representation of the given object to the string buffer.

setLength

public void setLength(int zero)
Empties the StringBuffer and clears out its contents so it may be reused. The only value that can be passed to this method is 0. The method is called setLength() for compatibility reasons only.

toString

public String toString()
Converts the string buffer to its string representation.
Overrides:
toString in class Object