aspose file tools*
The moose likes Java in General and the fly likes How to replace comma (,) with a dot (.) using java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "How to replace comma (,) with a dot (.) using java" Watch "How to replace comma (,) with a dot (.) using java" New topic
Author

How to replace comma (,) with a dot (.) using java

alpesh helwatkar
Ranch Hand

Joined: Apr 06, 2009
Posts: 30

Hi i'm doing


for replacing the comma with a dot but unable to do so... m i using the wrong regular expression?. please help
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4664
    
    5

Regex looks to be ok, but you're discarding the return value.


luck, db
There are no new questions, but there may be new answers.
alpesh helwatkar
Ranch Hand

Joined: Apr 06, 2009
Posts: 30

so should i take it in a new variable? like
Matthew Brown
Bartender

Joined: Apr 06, 2010
Posts: 4490
    
    8

Or just the same variable:
I don't think the second argument needs to be a regular expression, just a standard string (with a few exceptions, but I don't think a dot is one of them).
alpesh helwatkar
Ranch Hand

Joined: Apr 06, 2009
Posts: 30

hi.. yes.. i did used the same variable and it worked! thnx for the support!
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19783
    
  20

Unless you need to use regular expressions, it's better to use replace: That way you don't need to worry about escaping any values.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to replace comma (,) with a dot (.) using java