I have an string array of size 10:
[0] = "1,0000000" [1] = "479,00000" .... [9] = "145,0".
I want to remove the trailing ",00000" of the first 9 elements with regex and linq. Please help.
Basically I would do this like that :
var yourArray = new string[10];
var yourResult = yourArray.Take(9).Select(s => s.Split(',')[0]).ToArray();
But you can replace the Select method content with a Regex call if you wish.
split
Regex.Replace(string, ",0+$", "")add*instead of+if necessary.