Substr()

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?

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.