Skip to content

Instantly share code, notes, and snippets.

@thebitbrine
Last active July 26, 2019 00:55
Show Gist options
  • Save thebitbrine/bcee086f59431ec5790ec989596d8db0 to your computer and use it in GitHub Desktop.
Save thebitbrine/bcee086f59431ec5790ec989596d8db0 to your computer and use it in GitHub Desktop.
public string CleanText(string Input)
{
string res = Input.Replace("\r", "").Replace("\n", "").Replace("\t", "").Replace("\b", "");
if (res.StartsWith(' '))
res = res.Remove(0, 1);
if (res.EndsWith(' '))
res = res.Remove(res.Length - 1, 1);
while (res.Contains(" "))
res = res.Replace(" ", " ");
return res;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment