"Text can represent a combination of digits, letters, punctuation, words, sentences, and more. Computer programs that process text need assistance (from their associated languages) to represent and manipulate text. Java provides such assistance through the Character, String, StringBuffer, and StringTokenizer classes. In this article, you'll create objects from these classes and examine their various methods. You'll also receive answers to three mysteries: why Java regards a string literal as a String object, why String objects are immutable (and how immutability relates to string internment), and what happens behind the scenes when the string concatenation operator concatenates two strings into a single string."
"Subsequent to the publication of my article on character and string classes, a problem with the StringTokenizer class was brought to my attention. The problem deals with the String delim parameter that is part of two StringTokenizer constructors. To many developers, that parameter's String type suggests that StringTokenizer recognizes multicharacter delimiters (such as ###). Instead, StringTokenizer interprets that parameter as a set of one-character delimiters. This confusion over what delim means would disappear if delim had character array type (char []). For more information on the problem and a multicharacter delimiter solution, read "Steer Clear of Java Pitfalls," Michael Daconta (JavaWorld, September 2000)."
"Editor's note: Sometimes, the most interesting discussions begin when someone says, "This may be a stupid question, but ...". If the person asking the question has taken the time to think about the problem before asking, the question is often not stupid at all. The uncertainty points out an ambiguity in the specs, holes in the docs, or a search for how more experienced programmers might address a particular problem. From time to time, we will print one of the "(Not So) Stupid Questions" we receive and invite our readers to answer the question in the feedback section. This one began in a different form as a suggestion from Vladimir V. Ostromensky. He sent us some sample code somewhat like the code we present below with a question about String equality. We have adapted and extended his initial question."
"Fast string-searching algorithms such as KMP and Boyer-Moore require the ability to back up or perform random access in the text being searched. Unfortunately, you can't do this with international text in JDK 1.1, because CollationElementIterator does not allow random access. It only has a next method and is lacking setOffset and previous . This means that Boyer-Moore searching cannot be implemented without a complicated buffering scheme that is very tricky to get right."
"Internationalization is a common need for applications, yet is one of the last things considered in many projects. Retrofitting to allow internationalization can be complex and cumbersome by adding API calls and creating disparities between string literal and resource reference processing. This article introduces a technique for referencing resources using keys encoded within normal character strings, delimited by Unicode SOS/ST character combinations, allowing easy localization of an application without changing its logic or undertaking complex internationalization renovations. String resource references bring the added benefits of recursive references and the ability to mix with literal character sequences."
"In that case, as far as I know, the only way to implement the SHA is to follow Steve Reid's originial C++ code step by step. But there also exist some Java translations on the Net."
"You all know what happens next: More meetings with designers and/or clients. I've never met a developer who likes meetings, so the developer may not even be in these meetings, although he/she will be used as an absolute authority by the team lead that there is nothing that can be done (even if that isn't what they said). It is very common that the person that writes the CSS and the one who writes the dynamic page code are different people, with different perspectives and agreement that this cannot be fixed. Design changes are made to accommodate and the client and/or designer is dissatisfied. Not a happy ending. I know; I have been that team lead and both dynamic coder and CSS developer."
"The phrases in this chapter show you some common tasks involving strings. The Java language has strong built-in support for strings and string processing. Unlike the C language, strings are built-in types in the Java language. Java contains a String class that is used to hold string data. Strings in Java should not be thought of as an array of characters as they are in C. Whenever you want to represent a string in Java, you should use the String class, not an array."