How can I extract a substring in c++ of all the characters before a * character. For example, if I have a string
ASDG::DS"G*0asd}}345sdgfsdfg
how would I extract the portion
ASDG::DS"G
How can I extract a substring in c++ of all the characters before a * character. For example, if I have a string
ASDG::DS"G*0asd}}345sdgfsdfg
how would I extract the portion
ASDG::DS"G
You certainly don't need a regular expression for that. Just use
std::string::find('*')
andstd::string::substr
:I think your text doesn't have multiple
*
becausefind
return with first*