I am trying to get a number from US Format "11.11" to European Format "11,11" using strings and the built in function: "replaceFirst". However I found an interesting behaviour:
tmp_string_price_ = "abcde";
tmp_string_price = tmp_string_price_.replaceFirst("c",",");
returns "ab,de" as it should be
however
tmp_string_price_ = "ab.de";
returns
",b.de"
Correspondingly, it seems that an "." is found at the first position, even if is not what I have stored in that string.
Obviously, with numbers works similar:
tmp_string_price_ = "12.34";
tmp_string_price = tmp_string_price_.replaceFirst(".",",");
returns ",2.34" instaed of 12,34
Any idea how to proceed ? Why is the "." found in the first place of a string?
Thanks
-----------------
PS: In the meanwhile I have checked that the system detects the "." in the 2 position (indexOf) and calculates also the right prefix (getPrefix)
But despite of the correct index and the correct prefix, the replacement occurs on the wrong place.
workaround: get prefix, get sufix and add prefix +","+sufix, however I think something weird is here