Results 1 to 5 of 5
Thread: Java String Replace
- 05-17-2011, 04:31 AM #1
Member
- Join Date
- May 2011
- Posts
- 2
- Rep Power
- 0
- 05-17-2011, 04:44 AM #2
If it will always be the last semi-colon then you can use lastIndexOf and substring.
- 05-17-2011, 05:27 AM #3
(untested)
Java Code:replaceAll(";[^;]*$", "")
I wanna replace the string after the last ';' available in the above string.
When seeking help with regexes, it's always better to post a few examples of input and desired output.
db
- 05-17-2011, 08:31 AM #4
Member
- Join Date
- May 2011
- Posts
- 2
- Rep Power
- 0
Thanks, I like the replaceAll(";[^;]*$", "") option.
- 05-17-2011, 09:46 AM #5
Similar Threads
-
replace string, what is faster
By henry123 in forum Advanced JavaReplies: 12Last Post: 03-02-2011, 10:57 AM -
Java help - Replace all if string contains multiple substrings
By bobocheez in forum New To JavaReplies: 9Last Post: 08-31-2010, 06:21 AM -
Replace String
By Raeghin in forum New To JavaReplies: 1Last Post: 07-28-2009, 04:58 PM -
[SOLVED] how to replace exact string in java
By pankaj_salwan in forum New To JavaReplies: 22Last Post: 07-08-2008, 10:28 AM -
String replace method
By venkata.tarigopula in forum Advanced JavaReplies: 1Last Post: 07-10-2007, 09:14 PM
Bookmarks