waba.lang
Class String

waba.lang.Object
  |
  +--waba.lang.String

public class String
extends Object

String is an array of characters.

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

 String s = new String("Hello");
 


Constructor Summary
  String()
          Creates an empty string.
  String(char[] c)
          Creates a string from the given character array.
  String(char[] c, int offset, int count)
          Creates a string from a portion of the given character array.
  String(String s)
          Creates a copy of the given string.
protected String(String[] s, int count)
          Creates a string from an array of strings.
 
Method Summary
 char charAt(int i)
          Returns the character at the given position.
 String concat(String s)
          Concatenates the given string to this string and returns the result.
 boolean equals(Object obj)
          Returns true if the given string is equal to this string and false otherwise.
 int length()
          Returns the length of the string in characters.
 String substring(int start, int end)
          Returns a substring of the string.
 char[] toCharArray()
          Returns this string as a character array.
 String toString()
          Returns this string.
static String valueOf(boolean b)
          Converts the given boolean to a String.
static String valueOf(char c)
          Converts the given char to a String.
static String valueOf(float f)
          Converts the given float to a String.
static String valueOf(int i)
          Converts the given int to a String.
static String valueOf(Object obj)
          Returns the string representation of the given object.
 

Constructor Detail

String

public String()
Creates an empty string.

String

protected String(String[] s,
                 int count)
Creates a string from an array of strings. This method is declared protected and for internal use only. The StringBuffer class should be used to create a string from an array of strings.

String

public String(String s)
Creates a copy of the given string.

String

public String(char[] c)
Creates a string from the given character array.

String

public String(char[] c,
              int offset,
              int count)
Creates a string from a portion of the given character array.
Parameters:
c - the character array
offset - the position of the first character in the array
count - the number of characters
Method Detail

length

public int length()
Returns the length of the string in characters.

charAt

public char charAt(int i)
Returns the character at the given position.

concat

public String concat(String s)
Concatenates the given string to this string and returns the result.

toCharArray

public char[] toCharArray()
Returns this string as a character array. The array returned is allocated by this method and is a copy of the string's internal character array.

valueOf

public static String valueOf(boolean b)
Converts the given boolean to a String.

valueOf

public static String valueOf(char c)
Converts the given char to a String.

valueOf

public static String valueOf(int i)
Converts the given int to a String.

valueOf

public static String valueOf(float f)
Converts the given float to a String.

toString

public String toString()
Returns this string.
Overrides:
toString in class Object

valueOf

public static String valueOf(Object obj)
Returns the string representation of the given object.

substring

public String substring(int start,
                        int end)
Returns a substring of the string. The start value is included but the end value is not. That is, if you call:
 string.substring(4, 6);
 
a string created from characters 4 and 5 will be returned.
Parameters:
start - the first character of the substring
end - the character after the last character of the substring

equals

public boolean equals(Object obj)
Returns true if the given string is equal to this string and false otherwise. If the object passed is not a string, false is returned.