how to ignore the rest of the string


I need a function that ignore reading the rest of a stringĀ 
For example if a character is "/" I want to ignore reading it and what comes after it till the end of the string .
If I have this tring

String a= " adfh//ghjl"
I want my code to ignore reading characters "//ghjl".

1
2
std::string remove_tail( const std::string& str, char tail_begin )
{ return str.substr( 0, str.find(tail_begin) ) ; }

http://coliru.stacked-crooked.com/a/a0646745bfdd60d0
Topic archived. No new replies allowed.