| 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: 4203
|
|
|
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: 3865
|
|
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: 19232
|
|
|
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
How To Ask Questions How To Answer Questions
|
 |
 |
|
|
subject: How to replace comma (,) with a dot (.) using java
|
|
|