10.05.2009, 22:14
Does anyone know, how i can detect capital letters?
switch(letter){
case a: //blah
case A: //blah
}
Originally Posted by Weirdosport
As far as strings are concerned, A and a are different ascii characters, so if you were to use Switch:
pawn Код:
|
Originally Posted by 0rb
Lower case characters is range 0x61 - 0x7A, and upper case characters is range 0x41 - 0x5A. This is only for characters a-z and A-Z, not а or А or whatever. To convert a upper character to a lower character, add 0x20, and, as you already guessed i think, for lower to upper, substract 0x20.
|
#if !defined NO_CAPS_PROTECTION
#define UpperToLower(%1) for ( new ToLowerChar; ToLowerChar < strlen( %1 ); ToLowerChar ++ ) if ( %1[ ToLowerChar ] > 64 && %1[ ToLowerChar ] < 91 ) %1[ ToLowerChar ] += 32
#endif