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

AHmad

I am having a String str = "12.12 is a float number." I want to replace the .(Dot) with ,(comma) for decimal number calculation,

Currently i am trying this :

 system.out.println(str.replaceAll("\\d+\\.\\d+", "\\d+\\,\\d+"));

target output: "12,12 is a float number." please help

Chris Jester-Young

You have to use capturing groups:

str.replaceAll("(\\d+)\\.(\\d+)", "$1,$2")

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

how to replace comma with dot

From Dev

Replace ,(comma) by .(dot) and .(dot) by ,(comma)

From Dev

In Java, convert the dot to comma in DecimalFormat replace method

From Dev

Extracting a number with dot and comma using regex

From Dev

How to replace dot with comma in price format in php

From Dev

How can i replace dot with comma in iReport?

From Dev

Java floating point number in comma instead of dot

From Dev

Replace dot with comma on SELECT

From Dev

Need to replace "comma" with 'dot'

From Dev

How can I Accept only letter, number, comma (,) and dot (.) using php

From Dev

Replacing comma by dot only in numbers in a texteditor using search and replace function

From Dev

Python regex for number with or without decimals using a dot or comma as separator?

From Dev

Replace comma with dot in a input Javascript

From Dev

replace comma to dot in perl array

From Dev

javascript replace comma with dot / paypal

From Dev

Replace comma with dot in a input Javascript

From Dev

match float with comma and then replace comma with dot?

From Dev

Replace dot with a space and reverse using java swing

From Dev

How to replace a single number from a comma separated string in oracle using regular expressions?

From Dev

How to replace comma ',' in an arraylist to ' / ' using javascript

From Dev

How to use comma and dot as delimiter in addition with Java default delimiter

From Dev

Replace a dot with a comma inside a jQuery template

From Dev

replace comma with dot in scientific notation in r

From Dev

Replace comma with a dot while typing jQuery

From Dev

Replace a dot with a comma inside a jQuery template

From Dev

Decimalformat: unwanted replace of dot with comma in JTable

From Dev

Replace dot character once entered by a comma in jquery

From Dev

Best way to replace comma with a dot jquery

From Dev

Difference between decimal number with comma and dot Javascript

Related Related

  1. 1

    how to replace comma with dot

  2. 2

    Replace ,(comma) by .(dot) and .(dot) by ,(comma)

  3. 3

    In Java, convert the dot to comma in DecimalFormat replace method

  4. 4

    Extracting a number with dot and comma using regex

  5. 5

    How to replace dot with comma in price format in php

  6. 6

    How can i replace dot with comma in iReport?

  7. 7

    Java floating point number in comma instead of dot

  8. 8

    Replace dot with comma on SELECT

  9. 9

    Need to replace "comma" with 'dot'

  10. 10

    How can I Accept only letter, number, comma (,) and dot (.) using php

  11. 11

    Replacing comma by dot only in numbers in a texteditor using search and replace function

  12. 12

    Python regex for number with or without decimals using a dot or comma as separator?

  13. 13

    Replace comma with dot in a input Javascript

  14. 14

    replace comma to dot in perl array

  15. 15

    javascript replace comma with dot / paypal

  16. 16

    Replace comma with dot in a input Javascript

  17. 17

    match float with comma and then replace comma with dot?

  18. 18

    Replace dot with a space and reverse using java swing

  19. 19

    How to replace a single number from a comma separated string in oracle using regular expressions?

  20. 20

    How to replace comma ',' in an arraylist to ' / ' using javascript

  21. 21

    How to use comma and dot as delimiter in addition with Java default delimiter

  22. 22

    Replace a dot with a comma inside a jQuery template

  23. 23

    replace comma with dot in scientific notation in r

  24. 24

    Replace comma with a dot while typing jQuery

  25. 25

    Replace a dot with a comma inside a jQuery template

  26. 26

    Decimalformat: unwanted replace of dot with comma in JTable

  27. 27

    Replace dot character once entered by a comma in jquery

  28. 28

    Best way to replace comma with a dot jquery

  29. 29

    Difference between decimal number with comma and dot Javascript

HotTag

Archive