public int[] GetIntArrayFromDelimitedString(string str, char delimiter)
{
int[] response = new int[str.Split(delimiter).Length];
for (int i = 0; i < response.Length; i++)
response[i] = Convert.ToInt32(str.Split(delimiter)[i]);
return response;
}
Great stuff! Thanks...
ReplyDeleteOptimized Code can be :
ReplyDeletepublic int[] GetIntArrayFromDelimitedString(string str, char delimiter)
{
int[] response = new int[str.Split(delimiter).Length];
string[] arr = str.Split(delimiter);
for (int i = 0; i < response.Length; i++)
{
response[i] = Int32.Parse(arr[i]);
}
return response;
}