I'm trying to take a string and take out any character that isnt a letter so all that is left is the letters with no spaces.
Thats what the code I came up with looks like.Code:string line, nospc, nodigit; int j = 0; line = "jggg665 ugigigh"; nospc = line; int len = line.length(); for (int i=0; i<len; i++) { if (isalnum(line[i])) { nospc [j] = line [i]; j = j + 1; } }
I tried to get rid of the spaces in the line string but what it printed out was the same thing, only with the spaces filled in with letters. I want the letters after the spaces to simply move over.
I've been stuck on this for hours.
Any help is very welcome!



LinkBack URL
About LinkBacks


