| Author |
Removing single quotes from the string
|
Andy Shende
Greenhorn
Joined: Oct 12, 2009
Posts: 5
|
|
Hi,
I want to remove single quotes from the string, e.g.
input = can't don't won't
output = cant dont wont
I tried
But none of those worked for me
Can somebody tell me how to do that? Checking every character won't be a good choice for me.
|
Andy
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56538
|
|
|
You do realize that Strings are immutable and that replace() won't change the String itself, but will create a new one returned as the value of the method. Right?
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
Andy Shende
Greenhorn
Joined: Oct 12, 2009
Posts: 5
|
|
|
Yes, I am collecting it in another variable
|
 |
Henry Wong
author
Sheriff
Joined: Sep 28, 2004
Posts: 16815
|
|
Andy Shende wrote:Yes, I am collecting it in another variable
Then the first option should work ... maybe you can show us exactly what you did?
Henry
|
Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
|
 |
Vikash Ananda
Ranch Hand
Joined: Oct 12, 2009
Posts: 32
|
|
did you solve it??
try this:
|
 |
Andy Shende
Greenhorn
Joined: Oct 12, 2009
Posts: 5
|
|
worked. It was some logical error in my code. sorry for the trouble
|
 |
 |
|
|
subject: Removing single quotes from the string
|
|
|