Test a string to see if it has any white space character. Only ASCII space, CR and LF characters are tested but multibyte string can be supported.
BOOL is_str_has_space( LPCSTR lpcsz, BOOL bExposedOnly = true )
true if string has at least one white space character, which include CR and LF ;otherwise false
EX1
void is_str_has_space_ex1() { string str = "Originlab[ ]"; //the white space inside parenthesis, it will not be considered default. // change str to "Origin lab" to see different result bool bRet =is_str_has_space(str); if(bRet) printf("the \"%s\" has white space in it\n",str); else printf("the \"%s\" does not have white space in it\n",str); }
EX2
void is_str_has_space_ex2() { //bExposedOnly is set false ,parenthesis will be ignored, //the white space inside should be considered string str = "Originlab[ ]"; printf("\n When bExposedOnly is set false \n"); bool bRet=is_str_has_space(str, 0); if(bRet) printf("the \"%s\" has a white space in it\n",str); else printf("the \"%s\" does not have a white space in it\n",str); }
origin.h