Highlights
All Snippets
Top 100 Snippets
Librarians
gbCodeLib

By Language
VB6
JavaScript
Perl
HTML
SQL
Java
DOS

GBIC >> Source Code >> Java >> Snippet

07 Strings


Strings are objects and have methods

char MyChar = 'a'        // single quotes around char type
String MyString = "abcde"   // double quotes around char type

Speical Escape Characters
\ '   single quote
\ "  double quote
\\  backslash
\t   tab
\r   carriage return
\f   formfeed
\n  newline

NewString = String1 + String 2         //concatenation operator is +
Numbers are concatenated as strings (Java figures out which is needed)

Methods / Properties
.equals
.length
.toUpperCase