Package java.lang

Class String

extends Object
implements Serializable, Comparable

The String class represents character sequences. All string literals (e.g. "abc") are implemented as instances of this class. The String class is immutable, i.e. once it is created a String object cannot be changed. If there is a necessity to make a lot of modifications to Strings of characters, then you should use the StringBuffer class.

The class String includes methods for examining individual characters of the sequence, for comparing strings, for searching strings, for extracting substrings, and for creating a copy of a string with all characters translated to uppercase or to lowercase.

The Java language provides special support for the string concatentation operator ( + ), and for conversion of other objects to strings. String concatenation is implemented through the StringBuffer class and its append method. String conversions are implemented through the method toString, defined by Object and inherited by all classes in Java.

Note that Strings are UTF8 encoded internally and char variables have only one byte. This has to be taken into account when concatinating strings with chars that exceed 127. Use the method Draw.writeASCIIText(String) to explicitly interpret the bytes of a string as ASCII.

Examples

byte[] bytes = {(byte)0xE2, (byte)0x88, (byte)0x80}; // UTF8 code for "∀"
String str = new String(bytes, 0, 3); // initializes String to "∀"

char c = 'μ'; // c will have the value 0xBC although the Unicode symbol is 0x3BC.

Public Constructors

Public Methods

Methods inherited from java.lang.Object

_INSERT_INHERITED_METHOD_ENTRY_HERE_

_INSERT_FIELDS_ENTRY_HERE_