by Michael Thomas
Topic | Notes |
String Class |
Note: The StringBuffer object allows strings to be concatenated without creating a new object. |
length() | Gives the number of
chars in a string. Example
|
substring() |
Examples
|
toUpperCase() | |
toLowerCase() | |
String.equals() vs StringBuffer.equals() |
Example: |
equalsIgnoreCase() | Example: |
charAT() | |
concat() | |
indexOf() | |
lastIndexOf() | |
toString() | |
trim() | |
Add examples | Need to Add examples: String
strExNull; |
Regular Expressions | java.util.regex
Class Pattern http://download.oracle.com/javase/6/docs/api/java/util/regex/Pattern.html#sum "\\d{5}" - any digit, exactly 5 times. Good for zip codes. |
match() | Ex: boolean valid = myZip.matches("\\d{5}"); // any digit, exactly 5 times |
split() | Ex: String[] fields = myString.split("\\|"); |