bool conf_get_int64(const Properties& conf, const std::string& name, int64& value, bool ignore_nonexist) { Properties::const_iterator found = conf.find(name); if (found == conf.end()) { return ignore_nonexist; } if (string_toint64(found->second, value)) { return true; } std::string size_str = string_toupper(found->second); value = atoll(size_str.c_str()); if (size_str.find("M") == (size_str.size() - 1) || size_str.find("MB") == (size_str.size() - 2)) { value *= (1024 * 1024); // convert to megabytes } else if (size_str.find("G") == (size_str.size() - 1) || size_str.find("GB") == (size_str.size() - 2)) { value *= (1024 * 1024 * 1024); // convert to kilobytes } else if (size_str.find("K") == (size_str.size() - 1) || size_str.find("KB") == (size_str.size() - 2)) { value *= 1024; // convert to kilobytes } else { return false; } return true; }
void ArdbLogger::SetLogLevel(const std::string& level) { std::string level_str = string_toupper(level); for (uint32 i = 0; (i + 1) < ALL_LOG_LEVEL; i++) { if (level_str == kLogLevelNames[i]) { kDeafultLevel = (LogLevel) (i + 1); } } }
void nvpair_print_table_header(FILE * s, struct nvpair_header *h) { while(h->name) { char *n = xxmalloc(h->width + 1); fill_string(h->title, n, h->width, h->align); string_toupper(n); printf("%s ", n); free(n); h++; } printf("\n"); }
int main(void){ char asd[] = "ajeje"; char foo[] = "FOOBAR"; printf("%d\n", is_vowel('A')); printf("%d\n", is_vowel('b')); printf("%d\n", char_to_digit('5')); printf("%s\n", string_toupper(asd)); printf("%s\n", string_tolower(foo)); return 0; }
TEST(String, Case) { char *str; str = strdup ("ABC"); string_tolower (str); STRCMP_EQUAL("abc", str); string_toupper (str); STRCMP_EQUAL("ABC", str); free (str); }
//[[Rcpp::export]] std::vector < std::string > string_toupper_vector(std::vector < std::string > str){ return string_toupper(str); }
//[[Rcpp::export]] std::string string_toupper_single(std::string str){ return string_toupper(str); }