This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Hi, I am using getParameter() to grab a hidden field on a jsp. My problem is that the string coming back is separated by commas including an extra one on the end (ex. value1,value2,value3,) this is playing havoc with my substring. It seems to think there is another value after the last comma and is bringing me back a blank. So I guess my question is what is the best way to get rid of/ignore this last comma? Any suggestions would be appreciated.
If you think a reusable utility will be worth while over your lifetime, you might implement something from the REXX language: strip( string, whichend, what ). To strip trailing commas you could say s = Utility.strip(s, "T", ","). I used to use this to remove leading zeros all the time, but can't say I've used my Java implementation much.
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi