String help

Nov 7, 2016 at 12:33pm
How can I read a string starting at the second letter until the end of the string? I tried something like stringname[1,stringname.length()] but that didn't work.

Nov 7, 2016 at 12:44pm
string myString = stringname.substr(1);
Last edited on Nov 7, 2016 at 12:44pm
Nov 7, 2016 at 8:27pm
As a follow-up see http://www.cplusplus.com/reference/string/string/substr/.

Boxbird's answer is correct. That will initialize myString to the contents of stringname starting from the second letter.
Topic archived. No new replies allowed.