i was wondering how i could split a string like "L-0,12,0,12", so that i only get the seperate numbers. -0,12 and -0,12. Those are two different numbers that i need to extract from the string. Does anyone know how to fix this? i have tried split for string, but then its splits all ','.
I want to get 2 outputs of output1 = -0,12 and output2 = 0,12.
There is nothing behind the string, only the first letter and then the 2 numbers in decimal. Its a SVG format coordinate. the full svg string is: "M0,-0,12 L-0,12,-0,12 L-0,12,0,12 L0,12,0,12 L0,12,-0,12 L0,-0,12", but i already had filterd the string by spaces so the array only returns every sub string with a letter as start of the string.
The picture shows what the output is of the string array if i split them with onlt the spaces as a split char.
Output of string array Its in C#.
SOLUTION : It was the culture settings that did the job. In my country numbers are separated with commas and in the English / US culture mode it is being separated with a '.' before the decimal. I changed the culture settings of my code before the code started running and now i get the SVG string format that i wanted to get, so i can divide them with the commas.
Fyi:
// Change current culture
CultureInfo culture;
if (Thread.CurrentThread.CurrentCulture.Name == "nl-NL")
culture = CultureInfo.CreateSpecificCulture("en-US");
else
culture = CultureInfo.CreateSpecificCulture("nl-NL");
Thread.CurrentThread.CurrentCulture = culture;
Thread.CurrentThread.CurrentUICulture = culture;
Regards,
Giorgio
// using the method
String[] strlist = regionString.Split(separator, count,
StringSplitOptions.RemoveEmptyEntries);