string[] SplitString = MyVar.Split(',')
Then use SplitString.Length to find out how many there are and get the last 2.
string[] digits = UniqueCode.Split(',');
foreach (string s in digits)
{
if (s.Length>5)
{
HUCode = s;
}
if (s.Substring(0,1).Contains("E"))
{
s.Remove(0,5);
}
}
string[] digits = UniqueCode.Split(',');
string[] Codes = new string[digits.Length - 1];
string[] Numbers = new string[digits.Length - 1];
int a,b;
a=0;
b=0;
foreach (string s in digits)
{
if (s.Length>5)
{
Numbers[a]=s;
a +=1;
}
if (s.Substring(0,1).Contains("E"))
{
Codes[b]=s;
b +=1;
}
}
If you are experiencing a similar issue, please ask a related question
Join the community of 500,000 technology professionals and ask your questions.
Connect with top rated Experts
18 Experts available now in Live!