When I wrote in C, I only checked the value between 'A' and 'Z' when I checked the capital letters.
inline int is_upper_alpha(char chValue)
{
return ((chValue >= 'A') && (chValue <= 'Z'));
}
But when I looked at the code that someone else made on C++, I split the capitalization test into many different ranges. Is there a reason why you do this?
inline int is_upper_alpha(char chValue)
{
if (((chValue >= 'A') && (chValue <= 'I')) ||
((chValue >= 'J') && (chValue <= 'R')) ||
((chValue >= 'S') && (chValue <= 'Z')))
return 1;
return 0;
}
To illustrate this, you need to know the C/C++ standard.
The C/C++ standard stipulates that the character up to '0'
-'9'
must have a continuous value
There are no rules for other char
types.
This may not be 'B' = 'A'+1
in the C/C++ standard.
I
-J
and R
-S
is not a consecutive number.
581 PHP ssh2_scp_send fails to send files as intended
916 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
618 Uncaught (inpromise) Error on Electron: An object could not be cloned
613 GDB gets version error when attempting to debug with the Presense SDK (IDE)
© 2024 OneMinuteCode. All rights reserved.