2.1.2.17 is_str_has_space


Description

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.

Syntax

BOOL is_str_has_space( LPCSTR lpcsz, BOOL bExposedOnly = true )

Parameters

lpcsz
[input] string to test
bExposedOnly
[input] if false the function will ignore any quote and parenthesis, white spaces inside parenthesis shoud be considered, otherwise white spaces inside parenthesis are not considered

Return

true if string has at least one white space character, which include CR and LF ;otherwise false

Examples

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);
}

Remark

See Also

Header to Include

origin.h

Reference