#include <stdio.h>
#include <string>
int main(void)
{
printf("%u\n", std::string("\n").find_first_not_of(" \t\n\v\f\r", 0, 1));
}
The following program prints 0, not std::string::npos as I expected. Why?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Your call matches:
nis the number of chars in s, and you’re passing 1. So, you’re searching for the first char that is not space. The rest of your" \t\n\v\f\r"string is ignored.Likely you simply want: