Results 1 to 2 of 2
- 05-07-2008, 01:15 AM #1
Member
- Join Date
- May 2008
- Posts
- 1
- Rep Power
- 0
replacing last comma in a string with the word "or"
Hi,
This is my first post (and probably not my last!). I am just getting back to JSP, JSTL in particular, after being away from minor dabbling in it six years ago. I guess I'm practically a noob, so might as well start of with a good question...
I have a variable containing the string "a,b,c,d,e."
I need to replace the last "," with the word "or" (i.e. "a,b,c,d,e" becomes "a,b,c,d or e").
I know fn:indexOf is probably the best solution, but I have no clue as to the entire syntax of making this happen. Any help is greatly appreciated.
Thanks,
Bill
- 05-07-2008, 01:19 AM #2
You can use String.lastIndexOf() or one of the String.replace(...) with a regular expression. Here is the syntax: String (Java Platform SE 6)
Daniel @ [www.littletutorials.com]
Language is froth on the surface of thought
Similar Threads
-
Hwlp with "Open", "Save", "Save as..."
By trill in forum New To JavaReplies: 3Last Post: 11-02-2010, 09:26 AM -
"Jumble" or "Scramble" Program
By Shadow22202 in forum Java AppletsReplies: 8Last Post: 04-30-2008, 03:42 AM -
failure at Class.forName("oracle.jdbc.driver.OracleDriver");
By RonNYC in forum EclipseReplies: 1Last Post: 03-14-2008, 02:51 PM -
Exception in thread "main" java.net.ConnectException: Connection timed out
By osval in forum Advanced JavaReplies: 1Last Post: 07-27-2007, 10:59 PM -
ArrayList: Exception in thread "main" java.lang.NullPointerException
By susan in forum New To JavaReplies: 1Last Post: 07-16-2007, 06:32 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks