FAQ
 
 
Cover  \ Exhibition  \ Learning  \ Reference  \ Download  \ Discourse   
      Language \ Environment \ Libraries \ Comparison
 
   
   
Abridged (A-Z) \ Complete (A-Z)  
   
  Reference for Processing (BETA) version 91+. 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 

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').

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/
   
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

   
   
Constructors  
String(data)
String(data, offset, length)
   
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: Fri Jul 15 16:36:11 PDT 2005
 
 








Creative Commons License
 
  Processing is an open project initiated by Ben Fry and Casey Reas  
  © Info