aspose file tools
The moose likes Java in General and the fly likes Removing single quotes from the string Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "Removing single quotes from the string" Watch "Removing single quotes from the string" New topic
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
    
  14

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
    
  19

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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Removing single quotes from the string
 
Similar Threads
criteria format in criteriaFind method
replace method for String
escaping html characters and a string starting with double quote
Using JDBC how to put single quotes(')
Creating a table cell with text containing an apostrophe