Created
February 26, 2019 09:14
-
-
Save jshardy/0cf1434f96760f0ab94faf334c9cbf08 to your computer and use it in GitHub Desktop.
Chomp String From End with Char
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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