Replace the decimal symbol in a long string (no string.replace)

This is the string, there will be 2 splits happening
Split 1 on , and then i get header:data,
Split 2 on : i get header(0) and data(1)

now there are amounts like below = 19,50 , I would like to change the comma in that particular substring.

ExidQ:0810044262879,NaamQ:Bendt Van hoey,NomenclatuurQ:870100,InfoQ:Jeugd - speelpleinen (-19 jaar),BetaaldBedragQ:19,50,DagenQ:2,VerstrekkingDatumRuwQ:06112018,IndexQ:d9e2f2a4-4c2f-43f2-b955-422b7934dcd5.pdf,BronQ:AV_Upload,FileNameCSVQ:20181123

So β€œbasically” i’m looking for a regex that changes the decimal from , to . no matter how many amounts in the string, no matter how big the string.

thx

Hi @matthias.sevenant,

I don’t know, but have you tried something like this:

myVar = myVar.Replace(",",".")

Do you believe it will help you in this case?

@acaciomelo

When using string.replace you replace all β€œ,” in the main string and that changes nothing :slight_smile:

my first split is on β€œ,” so when you change it the same "issue " occurs.

The regex to find all decimal numbers would probably be β€œ\d,\d\d”.
If you want to replace all instances of that you can call Regex.Replace(input, β€œ(?<=\d),(?=\d\d)”, β€œ.”, …)

1 Like

I see, please check @thediabloman response than.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.