aspose file tools
The moose likes Beginning Java and the fly likes how to replace characters in string Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "how to replace characters in string" Watch "how to replace characters in string" New topic
Author

how to replace characters in string

aulo aasmaa
Greenhorn

Joined: Aug 06, 2001
Posts: 15
Background:
I have a JTable (the problem is not in swing), where I have some columns of numbers. All numbers are formatted, so that 1000 becomes 1 000.00 or 1'000.00 and 12.1 becomes 12.10
Problem:
One of my processes understands the decimal places, but gives an error to the apostrophes (') and spaces.
Question:
How do I replace these characters with nothing? I mean How do I get from 1'000.00 to 1000.00, the decimal places remain, I only need to get rid of the bad characters.
Code

Tnx!
[This message has been edited by aulo aasmaa (edited August 15, 2001).]
aulo aasmaa
Greenhorn

Joined: Aug 06, 2001
Posts: 15
OK, found a way to handle the problem, but a new one appeared right away.
The following code transforms 1'000.00 to 1 000.00, but this
is no good. I would like to get rid of the space as well, but I cannot declare the "newchar" as ''

How do I remove the space?
aulo aasmaa
Greenhorn

Joined: Aug 06, 2001
Posts: 15
The solution I got from forums.java.sun.com:
(by anders.hedstrom )
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to replace characters in string
 
Similar Threads
converting a double value
rounding off in java
java.math.BigDecimal + java.math.BigDecimal ?
Formatting number values code example needed
adding big decimal numbers