Again I struggled with string handling and I just wanted to share in case someone encounters the same issue.
Like with REGEX I am always spending significant amount of time to find a solution for a seemingly easy problem.
I extract numbers from a file like 130,45 (please note the comma as the typical decimal character in Germany).
To transfer this to a number I use the string and replace the “,” with a period “.”.
The example below works fine - So far so good:
var Number costs= new DecimalType()
costs= strng.replaceAll(",",".") // changing the comma to a period
In the file there are sometimes higher numbers like 1.505,52 (one thousand five hundred something)
To transfer this string into a DecimalType I tried the same like above, but the other way around:
var String mny = "" mny = strng.replaceAll(".","") // removing the thousands period costs= mny.replaceAll(",",".") // changing the comma to a period
Which does not work (the first replaceAll).
But his does with double escapes:
mny = strng.replaceAll("\\.","")
Maybe it’s obvious to “real” SW developers - for me it’s not