Joined
·
1,984 Posts
I need a code snippet that will remove all non-alphanumeric characters from a string, and then put each word into a vector seperately. So far
Pseudo code
Code:
and nonAlphanumeric would just do a char to char comparison of all letters/numbers to string
is that any good? or is there a more efficient way to do this, as well i think my counters might be a lil off, but i just drew this up real quick for help
Pseudo code
Code:
Code:
for (i = 0; i < string.size(); i++){
prev = i
if(nonAlphanum(string[i]){
vector.push_back(string.substr(prev,i-1)
prev = i
}
}
is that any good? or is there a more efficient way to do this, as well i think my counters might be a lil off, but i just drew this up real quick for help