Utils
int to string
// no special include statement required
string s = to_string(12345);
// s is "12345" nowint to char
// no special include statement required
char itoc(int number) {
return char('0' + number);
}
char c = itoc(5);
// c is '5' now
char to int
// no special include statement required
int ctoi(char c){
return c - '0';
}
int i = ctoi('6');
// i is 6 nowis small case char (a-z) ?
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('?') // falseis upper case char (A-Z) ?
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('?') // falseLast updated