I am writing a title case program.At the moment, I am stuck.
I want to implement an excact find.What I have finds all occurence of that string.
1)
size_t f = st.find("foo"); // finds all occurence of foo.But I want it to only find the word foo, and not foobar.How can I achieve that.
2) My funcion is something like this
1 2 3 4
bool Book :: convertToTitleCase(char* inTitle) // I found it hard to do manipulations with a char pointer.
As such I converted it to a string
//
string temp, st(inTitle); convert inTitle to string
The problem I have, is that I cannot convert it back to a char pointer.
Any help and suggestions would be appreciated.
Let me know if you need more information
For the first part you could check if there is a space after foo possibly though it wouldn't work too well if it was the only word or if it was the last word or if it had a comma/period/ect.. after it. You could possibly make an array of valid choices and search for those the array in English would be something like: