user3788160
user3788160

Reputation: 3

How to add space two positions after each comma in string

I have a string like:

st = 0,090,000,170,16-0,030,19 0,330,19

How to add a spaces into it, two positions after each comma, to get string like:

st = 0,09 0,00 0,17 0,16 -0,03 0,19  0,33 0,19

Upvotes: 0

Views: 239

Answers (1)

Gowri Pranith Kumar
Gowri Pranith Kumar

Reputation: 1685

Using Regex.Replace like below

var oldString = "0,090,000,170,16 - 0,030,19 0,330,19";
var newString = Regex.Replace(oldString, ",[0-9]{2}", (match) => { return match.Value + " "; });

Upvotes: 3

Related Questions