The question and answer format leads you from string comparison, concatenation and processing techniques to the StringBuffer class and more advanced string manipulation methods with string and stream tokenizers.
What if you were One Percent Better with Java strings?
* You process strings like greased lightning
* You stop wasting time with elaborate kludges
* You slice and dice with words, letters and lists
* You stop tying yourself in knots over which string methods to use
* You love building real-world string applications
* You impress your friends with string and stream tokenizer tricks
What's inside the Java strings ebook?
* 16 core Java strings questions and answers
* 7 extra Java string answers from other FAQs
The Java strings FAQ ebook helps you solve problems like these.
The string class
Why is the String class declared final?
Your class won't compile with the error "cannot inherit from final java.lang.String". Find out why the string class is final.
* How many objects are created for identical strings?
* What's the use of the String constructor?
String methods and operators
Is the + operator overloaded?
The dual nature of the + operator confuses newcomers, it seems to be overloaded. Make sense of Java string concatenation and clear the confusion.
* One case prints a Java code, another a literal string!
* The == operator doesn't match strings correctly!
* How can you say the + operator is not overloaded in Java!
* How can I reverse the characters in a string?
String buffers and tokenizers
What's the difference in memory allocation for StringBuffers?
If your program uses too much memory and lots of short-lived strings, a StringBuffer may improve its performance.
* What is the difference between a String and StringBuffer?
* When should I use a StringBuffer instead of a String?
* Why don't two StringBuffers match?
* How can I pad a StringBuffer?
* What is a StringTokenizer for?
* How can I get a person's initials from their full name?
Extra Java strings questions
This ebook includes seven extra Java string-related answers from six other Java FAQs.
* Can I call the main() method with a String argument?
* How can I convert a String into a Date object?
* How can I generate an array from a list?
* How can I make spelling checker with a LinkedList dictionary?
* What does public static void main(String) mean?
* Why are command line arguments passed as a String?
* Is it possible to convert a string to an abstract path?