Removing everything after character (and also character)
I believe that will work.
std::string mystr = string1.substr(0, string1.find("%", 0));
std::string the_prefix_you_want = string1.substr(0, string1.find("%"));
See: http://www.cplusplus.com/reference/string/string/find/ and http://www.cplusplus.com/reference/string/string/substr/ for more details