int substr_index_from_char(char c) { int result = VOID_CHAR_IDX; if( is_lower_case(c) ){ return c - LOWER_A_ASCII; } else if( is_upper_case(c) ){ return c - UPPER_A_ASCII + UPPER_SUBSTR_OFFSET; } return result; }
/* Make all the characters in the word lower case. */ static void convert_to_lower(unsigned int *word) { int i; str_char* cword; cword = (str_char*) word; ASSERT(word); for (i=0; i < sizeof(unsigned int); i++) { if ( is_upper_case(cword[i]) ) cword[i] = (str_char) (cword[i] - OFFSET); } }
/* * Make a string all lower-case. */ void lower(char *string, char *dest) { if(string != NULL) { size_t str_len = strlen(string); snprintf(dest, str_len, "%s", string); int i; for(i = 0; i < str_len; ++i) { if(is_upper_case(dest[i])) dest[i] += 32; } } }