Hello.
I'm just getting started with
Java and having a bit of difficulty using Strings and StringBuffers. I decided to make a class that would take a
string (this was before I knew there two types in Java!) representing a name, split it into its constituent parts, capitalise the first letter of each of these and put them into an array. So, for example, the string "jack fraser lord" would be used to create an array ["Jack", "Fraser", "Lord"]
The code I came up with was:
This seems quite long winded to me but as far as I can tell I need to operate on a String type to split my string into tokens, and then operate on a StringBuffer to capitalise the first letter of each token. Is that right? I wondered if there was an easy way to split a StringBuffer into an array of StringBuffers that I could directly operate on - because at the moment I seem to be using Strings just so that I can get the tokens.
Sorry, that was a bit longer than I expected!
--Split the long comment to limit screen width - Carl
[ June 08, 2004: Message edited by: Carl Trusiak ]