Пример #1
0
	bool isStringFloat(std::string s)
	{
		if(!IS_STRING_VALID(s))
		{
			return 0;
		}

		if(!isCharNumeric(s[0]) && s[0] != '-')
		{
			return 0;
		}

		bool radixPointFound = 0;

		int stringLength = s.length();

		for(int i = 1; i < stringLength; ++i)
		{
			if(isCharNumeric(s[i]))
			{
				continue;
			}
			else if(s[i] == '.' && !radixPointFound)
			{
				radixPointFound = 1;
				continue;
			}

			return 0;
		}

		if(radixPointFound)
		{
			return 1;
		}
		
		return 0;
	}
Пример #2
0
	bool isStringInt(std::string s)
	{
		if(!IS_STRING_VALID(s))
		{
			return 0;
		}

		if(!isCharNumeric(s[0]) && s[0] != '-')
		{
			return 0;
		}

		int stringLength = s.length();

		for(int i = 1; i < stringLength; ++i)
		{
			if(!isCharNumeric(s[i]))
			{
				return 0;
			}
		}

		return 1;
	}
Пример #3
0
	bool isStringValidIdentifier(std::string s)
	{
		if(!IS_STRING_VALID(s))
		{
			return 0;
		}

		if(!isCharAlphabetic(s[0]))
		{
			return 0;
		}

		int stringLength = s.length();

		for(int i = 1; i < stringLength; ++i)
		{
			if(!isCharNumeric(s[i]) && !isCharAlphabetic(s[i]) && s[i] != '_')
			{
				return 0;
			}
		}

		return 1;
	}
Пример #4
0
unsigned char isCharAlphanumeric( char c )
{
	return ( isCharAlpha( c ) || isCharNumeric( c ) );
}