string TrimWordsFromString(string value, int numberOfWords, char separator, bool reverse)
{
int trimmedWords = 0;
int index = 0;
while(trimmedWords != numberOfWords)
{
if(value == string.Empty)
{
return string.Empty;
}
if(reverse)
{
index = value.Length - 1;
}
if(value[index] == separator)
{
trimmedWords++;
}
value = value.Remove(index, 1);
}
return value;
}