Hi so I am trying to make a function that gets a string and returns two or more different words if they are separated by hyphens.
input = some-thing
output = some thing (2 different words)
right now my function deletes the hyphens but returns them as one word.
any help is appreciated. thank you!
string normalWord(string str)
for (int i=0; i<str.length(); i++)
if(!((str[i]>='A' && str[i] <= 'Z')|| (str[i] >= 'a' && str[i] <= 'z')))
Last edited on
If you want to return separate strings, why is the return type only one string? Hint: you will want to use a vector of strings instead ;)
Instead of erasing the hyphen, change it to a space?
What do you mean? Each word would be an element in the vector, with no spaces or hyphens involved.