string question
Ok, so I am trying to get all the length of words in a file, but some words are special like "copy-cat" and I need to break them up into just "copy" and "cat" and it's been ages since I've worked with strings. How can I remove the "-" (or any other character like a "/", "." or "( )") from the word once I've taken it into a string (an actual string, not char)? I know the answer is probably trivial but for some reason I can't remember... I think I need more sleep. Thanks for any help.
-aquaman |
Or is there a way that when I take them into my
Code:
list<input> inList; |
I assume you're talking about C++, but without your second post there is no way of being able to tell. Just about every language has strings you know...
If thats the case it depends whether you're using std::string's or C-style char* strings. You didn't state that one either. C style, I would scan once, find 'n' number of bad items, make a new array of (size - n), and copy the valid ones over. Code:
int i, n, len; |
All times are GMT -5. The time now is 03:21 PM. |