Created
April 4, 2013 12:41
-
-
Save Morse-Code/5310046 to your computer and use it in GitHub Desktop.
Remove non-alphanumeric characters from a C string.
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 stringRemoveNonAlphaNum(char *str) | |
{ | |
unsigned long i = 0; | |
unsigned long j = 0; | |
char c; | |
while ((c = str[i++]) != '\0') | |
{ | |
if (isalnum(c)) | |
{ | |
str[j++] = c; | |
} | |
} | |
str[j] = '\0'; | |
// return str; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment