Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //test string
- std::string str = "a9382a_ao-EATSHITANDDIE_-_--__-";
- //go through each character in the string
- for(int i = 0; i < str.length(); i++)
- {
- char c = str[i];
- //if the character doesn't equal '_' or '-'
- if(!(c == '_' || c == '-'))
- {
- //check for numbers
- if(c >= '0' && c <= '9')
- continue;
- //check for upper-case letters
- if(c >= 'A' && c <= 'Z')
- continue;
- //check for lower-case
- if(c >= 'a' && c <= 'z')
- continue;
- //if it gets here, it is neither an alpha character or a number character,
- //and it isn't one of the two exempt characters, so we replace it with a space
- str[i] = ' ';
- }
- }
Add Comment
Please, Sign In to add comment