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
Substr()
Substr()
Feb 25, 2022 at 9:35am UTC
AAAbb7
(11)
I'm not sure how the substring input works. I have this code snipet:
if (validNum(input.substr(i, 2)))
{
++validCount;
}
What is input.substr(i,2) doing?
Feb 25, 2022 at 9:56am UTC
seeplus
(6597)
See
http://www.cplusplus.com/reference/string/string/substr/
The i is the start position (from 0) in the string, the 2 is the number of chars to extract.
Topic archived. No new replies allowed.