Skip to content

Instantly share code, notes, and snippets.

@jshardy
Created February 26, 2019 09:14
Show Gist options
  • Save jshardy/0cf1434f96760f0ab94faf334c9cbf08 to your computer and use it in GitHub Desktop.
Save jshardy/0cf1434f96760f0ab94faf334c9cbf08 to your computer and use it in GitHub Desktop.
Chomp String From End with Char
void ChompStringFromEnd(char *string, char chompChar)
{
int len = strlen(string);
while(string[len--] != chompChar && len >= 0)
{
if(string[len] == chompChar)
{
string[len + 1] = 0;
break;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment