Lowercase is not working
Closed this issue · 2 comments
potat-dev commented
Function that converts a character to lowercase does not work correctly
Example input:
HelloComMa WorldDoT How r UqStn
Expected output:
Hello, World. How r U?
But the program does not perform the replacement
potat-dev commented
I rewrote the algorithm for converting a letter to lowercase (StackOverflow)
char tolower(int c)
{
// (int)a = 97, (int)A = 65
// (a)97 - (A)65 = 32
// therefore 32 + 65 = a
return c > 64 && c < 91 ? c + 32 : c;
}
It can be written shorter:
#define tolower(c) c > 64 && c < 91 ? c + 32 : c
potat-dev commented
#define tolower(c) c > 64 && c < 91 ? c + 32 : c
not working...