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

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

From Dev

Need to replace "comma" with 'dot'

From Dev

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

From Dev

Replace dot with comma on SELECT

From Dev

match float with comma and then replace comma with dot?

From Dev

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

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

Extracting a number with dot and comma using regex

From Dev

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

From Dev

Difference between decimal number with comma and dot Javascript

From Dev

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

From Dev

how to replace comma with dot

From Dev

Replace comma with dot in a input Javascript

From Dev

Replace comma with a dot while typing jQuery

From Dev

Java floating point number in comma instead of dot

From Dev

replace comma to dot in perl array

From Dev

Replace dot with a space and reverse using java swing

From Dev

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

From Dev

javascript replace comma with dot / paypal

From Dev

Replace a dot with a comma inside a jQuery template

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

Replace comma with dot in a input Javascript

From Dev

Decimalformat: unwanted replace of dot with comma in JTable

From Dev

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

From Dev

Replace dot character once entered by a comma in jquery

From Dev

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

From Dev

Best way to replace comma with a dot jquery

Related Related

  1. 1

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

  2. 2

    Need to replace "comma" with 'dot'

  3. 3

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

  4. 4

    Replace dot with comma on SELECT

  5. 5

    match float with comma and then replace comma with dot?

  6. 6

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

  7. 7

    Replace a dot with a comma inside a jQuery template

  8. 8

    replace comma with dot in scientific notation in r

  9. 9

    Extracting a number with dot and comma using regex

  10. 10

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

  11. 11

    Difference between decimal number with comma and dot Javascript

  12. 12

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

  13. 13

    how to replace comma with dot

  14. 14

    Replace comma with dot in a input Javascript

  15. 15

    Replace comma with a dot while typing jQuery

  16. 16

    Java floating point number in comma instead of dot

  17. 17

    replace comma to dot in perl array

  18. 18

    Replace dot with a space and reverse using java swing

  19. 19

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

  20. 20

    javascript replace comma with dot / paypal

  21. 21

    Replace a dot with a comma inside a jQuery template

  22. 22

    How to replace dot with comma in price format in php

  23. 23

    How can i replace dot with comma in iReport?

  24. 24

    Replace comma with dot in a input Javascript

  25. 25

    Decimalformat: unwanted replace of dot with comma in JTable

  26. 26

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

  27. 27

    Replace dot character once entered by a comma in jquery

  28. 28

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

  29. 29

    Best way to replace comma with a dot jquery

HotTag

Archive