int StrCaseCompare(char *Str1, char *Str2) { if (Str1 == NULL || Str2 == NULL) return -1; char *s1 = Str1, *s2 = Str2; while (*s1 != '\0' && *s2 != '\0') { if (CharToUpper(*s1++) != CharToUpper(*s2++)) return -1; } if (*s1 != *s2) return -1; else return 0; }
void tmKey::UpdateShortcut() { shortcut.clear(); // Build shortcut string if (modifiers & 0x0002) shortcut += _("Ctrl-"); if (modifiers & 0x0001) shortcut += _("Alt-"); if (modifiers & 0x0008) shortcut += _("Win-"); if (modifiers & 0x0004) shortcut += _("Shift-"); //if (numpad) key.shortcut += _("Numpad-"); if (keyCode) { std::map<int, wxString>::const_iterator k = tmKey_s_keyText.find(keyCode); if (k != tmKey_s_keyText.end()) { if (keyCode == WXK_NUMPAD_ENTER) shortcut += _("Numpad-"); shortcut += k->second; } else { wxChar uniKey; if (tmKey::wxkToUni(keyCode, false, uniKey)) shortcut += CharToUpper(uniKey); else { // If we cannot get a valid shortcut (it might need a dead key combi // on this keyboard layout). We remove the shortcut shortcut.clear(); } } } //wxLogDebug(wxT("UpdateShortcut(%d - %c,%d) to '%s'"), keyCode, keyCode>32 ? keyCode : ' ', modifiers, shortcut.c_str()); }
void StringToUpperDestructive(char *out) { while (*out) { *out = CharToUpper((uc)(*out)); out++; } }
VOID CharsUtilTest() { CHAR c = 'a'; TEST('A' == CharToUpper(c), "CharToUpper failed"); TEST(10 == CharToHexDigit(c), "CharToHexDigit failed"); TEST(false == CharIsSpace(c), "CharIsSpace failed"); TEST(true == CharIsSpace(' '), "CharIsSpace failed"); //printf("Chars util tests completed\n"); }
/** Convert a Unicode character to numerical value. This internal function only deal with Unicode character which maps to a valid hexadecimal ASII character, i.e. L'0' to L'9', L'a' to L'f' or L'A' to L'F'. For other Unicode character, the value returned does not make sense. @param Char The character to convert. @return The numerical value converted. **/ UINTN EFIAPI HexCharToUintn ( IN CHAR16 Char ) { if (Char >= L'0' && Char <= L'9') { return Char - L'0'; } return (UINTN) (10 + CharToUpper (Char) - L'A'); }
void StringToUpper(char *in, int maxlen, /* RESULTS */ char *out) { char *orig_out; orig_out = out; maxlen--; while (*in) { if ((out - orig_out) >= maxlen) { orig_out[maxlen] = TERM; return; } *out = CharToUpper((uc)(*in)); in++; out++; } *out = TERM; }