sqldata/str.cpp
// Get integer part of number in string
Get integer part of number in string
Get integer part of number in string
const char* Str::GetIntegerPart(const char *str, int slen, char *out, int *out_len)
{
	if(str == NULL || out == NULL)
		return NULL;
	int i = 0;
	int len = 0;
	while(i < slen && str[i] == '0')
		i++;
	while(i < slen && str[i] != '.')
	{
		out[len] = str[i];
		i++;
		len++;
	}
	if(str[i] == '.')
		i++;
	if(out_len != NULL)
		*out_len = len;
	return str + i;
}
const char * Str :: GetIntegerPart ( const char * str , int slen , char * out , int * out_len ) { if ( str == NULL || out == NULL ) return NULL ; int i = 0 ; int len = 0 ; while ( i < slen && str [ i ] == ' ' ) i ++ ; while ( i < slen && str [ i ] != ' ' ) { out [ len ] = str [ i ] ; i ++ ; len ++ ; } if ( str [ i ] == ' ' ) i ++ ; if ( out_len != NULL ) * out_len = len ; return str + i ; }
Get integer part of number in string
Get integer part of number in string
// Skip leading zeros // Copy digits until . // Skip .