int main () { char s[] = "Now is the time"; printf("Before: %s \n", s); toUppercase(s); printf("After: %s \n", s); return 0; }
void createKwics(const std::unordered_map<std::string, int>& exclusions, const std::string& title, int id, std::vector<Kwic>& kwics) { char* titleString = new char[title.size() + 1]; int i = 0; //Gets a non const c string of the String for(auto iterator = title.begin(); iterator != title.end(); i++, iterator++) { titleString[i] = *iterator; } titleString[i] = '\0'; int leftPointer = 0; int rightPointer = 0; while(true) { //Found a word if(titleString[rightPointer] == ' ' || titleString[rightPointer] == '\0') { //The token in the string std::string word = title.substr(leftPointer, rightPointer - leftPointer); //Finds a word that is not an exclusion if(!isExclusion(exclusions, word)) { //Uppercases the word std::string titleCopy = title; titleCopy.replace(leftPointer, rightPointer - leftPointer, toUppercase(word)); //Creates the kwic Kwic kwic(word, titleCopy, id); kwics.push_back(kwic); } //If it's not the last word reposition pointers if(titleString[rightPointer]) { leftPointer = rightPointer + 1; rightPointer = rightPointer + 1; } else { break; } } else { rightPointer++; } } }
void set_log_level(char *pLogLevel) { if (pLogLevel != NULL) { toUppercase(pLogLevel); if ( strncmp(pLogLevel, "DEBUG", 5) == 0 || \ strcmp(pLogLevel, "LOG_DEBUG") == 0) { g_log_context.log_level = LOG_DEBUG; } else if ( strncmp(pLogLevel, "INFO", 4) == 0 || \ strcmp(pLogLevel, "LOG_INFO") == 0) { g_log_context.log_level = LOG_INFO; } else if ( strncmp(pLogLevel, "NOTICE", 6) == 0 || \ strcmp(pLogLevel, "LOG_NOTICE") == 0) { g_log_context.log_level = LOG_NOTICE; } else if ( strncmp(pLogLevel, "WARN", 4) == 0 || \ strcmp(pLogLevel, "LOG_WARNING") == 0) { g_log_context.log_level = LOG_WARNING; } else if ( strncmp(pLogLevel, "ERR", 3) == 0 || \ strcmp(pLogLevel, "LOG_ERR") == 0) { g_log_context.log_level = LOG_ERR; } else if ( strncmp(pLogLevel, "CRIT", 4) == 0 || \ strcmp(pLogLevel, "LOG_CRIT") == 0) { g_log_context.log_level = LOG_CRIT; } else if ( strncmp(pLogLevel, "ALERT", 5) == 0 || \ strcmp(pLogLevel, "LOG_ALERT") == 0) { g_log_context.log_level = LOG_ALERT; } else if ( strncmp(pLogLevel, "EMERG", 5) == 0 || \ strcmp(pLogLevel, "LOG_EMERG") == 0) { g_log_context.log_level = LOG_EMERG; } } }
char* _NativeFrameworkDSString::toUppercase(){ return toUppercase(); }