Utils

chevron-rightstring to inthashtag
// no special include statement required

int num = stoi("23");

// num is 23 now

chevron-rightint to stringhashtag
// no special include statement required

string s = to_string(12345);

// s is "12345" now
chevron-rightint to charhashtag
// no special include statement required

char itoc(int number) {
   return char('0' + number);
}

char c = itoc(5);

// c is '5' now

chevron-rightchar to inthashtag
// no special include statement required

int ctoi(char c){
    return c - '0';
}

int i = ctoi('6');

// i is 6 now
chevron-rightis small case char (a-z) ?hashtag
bool isSmallCaseChar(char c){
  return islower(c);
}

isSmallCaseChar('a') // true
isSmallCaseChar('z') // true
isSmallCaseChar('G') // false
isSmallCaseChar('0') // false
isSmallCaseChar('9') // false
isSmallCaseChar('%') // false
isSmallCaseChar('?') // false
chevron-rightis upper case char (A-Z) ?hashtag
bool isUpperCaseChar(char c){
  return isupper(c);
}

isUpperCaseChar('a') // false
isUpperCaseChar('z') // false
isUpperCaseChar('A') // true
isUpperCaseChar('G') // true
isUpperCaseChar('0') // false
isUpperCaseChar('9') // false
isUpperCaseChar('%') // false
isUpperCaseChar('?') // false
chevron-rightis digit ?hashtag
chevron-rightis alphaNumeric ?hashtag
chevron-rightget ascii value of characterhashtag
chevron-rightgcdhashtag
chevron-rightNCR (i.e. N-choose-R)hashtag

Last updated