cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
Beginners
String help
String help
Nov 7, 2016 at 12:33pm UTC
fivestar
(180)
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 UTC
Boxbird
(96)
string myString =
stringname.substr(1)
;
Last edited on
Nov 7, 2016 at 12:44pm UTC
Nov 7, 2016 at 8:27pm UTC
rghrist23
(27)
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.