I am trying to parse the string and see if the value after “:” is Integer. If it is not integer then remove “Test:M” from string.
Here is the example string I have.
string testString = "Test:34,Test:M";
The result I need testString = "Test:34"
string[] data = testString.Split(',');
for (int i = 0; i < data.Length; i++)
{
string[] data1 = data[i].Split(':');
int num = 0;
if(Int32.TryParse(data1[1], out num))
{
}
}
You could continue on with the looping structure but I, personally, like the look of LINQ a little better: