James Carman, President<br />Carman Consulting, Inc.
42
"I'm not back." - Bill Harding, Twister
Originally posted by Kashif Riaz:
How lazy can some programmers get? Its a 2 minute job in writing the code. Not everything is in the API! What next, a method to return true if integer x is more than integer y?
Originally posted by Amy Caine:
I have one small issue to deal with yet (putting spaces back in to the String) but I'll do some searching.
Originally posted by Amy Caine:
Now, what I am trying to do is to jazz it up a little and pass a String variable with several words in it, and capitalize the first letter of every part of it. I am using the StringTokenizer to do this.
Originally posted by Kashif Riaz:
How lazy can some programmers get? Its a 2 minute job in writing the code. Not everything is in the API! What next, a method to return true if integer x is more than integer y?
Layne, thank you for the suggestion! I really appreciate it when someone makes suggestions as to how things can be more efficient and coded more effectively. In my case, I have a setProper() method, then there is a setProperEachWord() method that calls the setProper() method for each token in the string. Is this what you are referring to?
One more scenario � how do you pass an instance of Customer to another method? Everything I�m reading says treat it as a variable, but I am getting static errors. I may have it set up wrong.
What I am trying to do is this; I have a string that is divided into 6 parts; first name, last name, address, city, state and zip. For each token I am calling a populateCustomer() method that defines what part of the string it is by taking the field number (ie case 0 = first name, case 1 = last name, etc. I have a counter in the while loop to determine this). It then sends this data to the setProperEachWord() method (see above) to change it to proper case.
Originally posted by Mark Spritzler:
All she wants is a String to be Proper Case. Proper Case is defined as the first letter of a word is capitalized, nothing more or less. No need to read further into the definition.
You guys sometimes make me laugh when you over analyze a question.
Mark
42
Originally posted by Jeroen Wenting:
Remember that not everyone has English as their native language (oh how I love to catch one of you at that ).
"proper" in my definition means "whatever it should be to be syntactically and gramatically correct", not "capitalise every first letter".
What that would be depends on the individual words as well as on the language that the OP wants to deal with.
Originally posted by Kashif Riaz:
I was refering to Mark Spritzler's reference as to whether a commons.lang package existed which could do the work, not the thread-starter.
James Carman, President<br />Carman Consulting, Inc.
Srijani Ghosh wrote:you may use the following process , i.e. using regex as follows-
James Carman wrote:If nothing else, you can download the code to see how they do it and maybe adapt it to your situation. That's what open source is all about.
Liar, liar, pants on fire! refreshing plug:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
|