I currently have this class to replace consecutive spaces by one:
public static string RemoveSpacesLoop(string value)
{
if(value.Contains(" "))
{
return RemoveSpacesLoop(value.Replace(" ", " "));
}
else
{
return value;
}
}
It works, but in the long run it may cause performance issues. is there a way to simplify this ?