In both methods you are checking if the result of the
Split()
has
greater than 2 items.
(I'm also assuming that you wanted the
backslash as you implied in the text of your question.)
Try:
private String removeCodeNumber(String covCode)
{
return covCode.Split('\\')[0];
}
private String removeCovcode(String codenbr)
{
String[] cov = codenbr.Split('\\');
if (cov.Length >= 2)
{
return cov[1];
}
return codenbr;
}