Could someone explain whats going on in this little segment of code? what each line does if possible please
Code:
static string[] groups = { "AEIOUHWY", "BFPV", "CGJKQSXZ", "DT", "L", "MN", "R" };
static string getCode(string str)
{
string tempstr = "";
int i;
for (i = 0; i < 7; i++)
{
if (groups[i].Contains(str))
{
tempstr = i.ToString();
break;
}
}
return tempstr;
}
static string encodeString(string str)
{
string tempstr = "";
int i;
for (i = 0; i < str.Length; i++)
{
tempstr = tempstr + getCode(str.Substring(i, 1));
}
return tempstr;
}
static string removeZeroes(string str)
{
string tempstr = "";
int i;
for (i = 0; i < str.Length; i++)
{
if (str.Substring(i, 1) != "0")
{
tempstr = tempstr + str.Substring(i, 1);
}
}
return tempstr;
}
static string RemoveAdjacent(string str)
{
string tempstr = "";
int i;
string stringToCheckAgainst = "#";
for (i = 0; i < str.Length; i++)
{
if (str.Substring(i, 1) != stringToCheckAgainst)
{
tempstr = tempstr + str.Substring(i, 1);
stringToCheckAgainst = str.Substring(i, 1);
}
}
return tempstr;
}
}
}