SKLAK SKLAK - 1 year ago 121
C++ Question

C++ How to get substring after a character?

For example, if I have

string x = "dog:cat";

and I want to extract everything after the ":", and return cat. What would be the way to go about doing this?

rcs rcs
Answer Source

Try this:

x.substr(x.find(":") + 1); 
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download