is_good_C_identifier

 

Description

Test if given string is a valid C or LabTalk compatible string to define a variable

Syntax

BOOL is_good_C_identifier( LPCSTR lpcsz, char cExtraAllowedChar = 0 )

Parameters

lpcsz
[input] string to test
cExtraAllowedChar
[input] if not 0, to specify an additional character to allow, which might not be allowed in C

Return

True if the string is a valid string to define a variable ,False if not.

Examples

EX1

void is_good_C_identifier_ex1()
{
        string str = "ab*";
        char ch = '*';
        //change ch to other char to see different result 
        bool bRet = is_good_C_identifier(str , ch);
        if(bRet)
        printf("\"%s\" is a good identifier\n" ,str);
        else 
        printf("\"%s\" is not a good identifier\n" ,str);

}

Remark

See Also

is_good_C_identifier_ex

header to Include

origin.h

Reference