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
seperating letters and numbers from stri
seperating letters and numbers from string using substr()
Sep 30, 2016 at 6:31pm UTC
persades
(34)
how can i go about using the substr() function to separate letters and numbers from a string into separate variables from a given input?
1
2
3
4
5
string str; cin >> str; string sub = str.substr(0, 1) string sub2 = str.substr(2,2)
but what if they input one letter or maybe two? and theres always the posibility that they might put a 1 ,2 ,3 ,10 ,15 digit number. im just completely lost on this one. thanks in advance
Oct 1, 2016 at 12:08am UTC
integralfx
(897)
http://www.cplusplus.com/reference/locale/isalpha/
http://www.cplusplus.com/reference/locale/isdigit/
Last edited on
Oct 1, 2016 at 12:09am UTC
Topic archived. No new replies allowed.