Search processing.org:

Reference for Processing (BETA) version 0135+. If you have a previous version, use the reference included with your software. If you see any errors or have any comments, let us know.

Name | ### String
Examples |
    String str1 = "CCCP";
    char data[] = {'C', 'C', 'C', 'P'};
    String str2 = new String(data);
    println(str1);  // Prints "CCCP" to the console
    println(str2);  // Prints "CCCP" to the console
    // Use a backslash to include quotes in a String
    String quoted = "This one has "quotes"";
    println(quoted);  // This one has "quotes"
Description | A string is a sequence of characters. The class String includes methods for examining individual characters, comparing strings, searching strings, extracting parts of strings, and for converting an entire string uppercase and lowercase. Strings are always defined inside double quotes ("Abc") and characters are always defined inside single quotes('A'). Because a String is defined within quotes, including quotes in a String requires the (backslash) character to be used (see the second example above). This is known as an escape sequence. Other escape sequences include t for the tab character, and n for new line. A single backslash is indicated by \. There are more string methods than those linked from this page. Additional String documentation is located at http://java.sun.com/j2se/1.4.2/docs/api/.
Fields |
Methods |
charAt() | Returns the character at the specified index
equals() | Compares a string to a specified object
indexOf() | Returns the index value of the first occurance of a character within the input string
length() | Returns the number of characters in the input string
substring() | Returns a new string that is part of the input string
toLowerCase() | Converts all the characters to lower case
toUpperCase() | Converts all the characters to upper case
Constructor |
    String(data)
    String(data, offset, length)
Parameters |
Parameters |
data | byte[] or char[]: array of bytes to be decoded into characters or array of characters to be combined into a string
offset | int: index of the first character
length | int: number of characters
Usage | Web & Application
Related | char text()

Updated on June 28, 2007 05:11:00am PDT