/**
 * Checks if a character is an hexadecimal digit
 *
 * @uses    PMA_STR_numberInRangeInclusive()
 * @uses    ord()
 * @param   string   character to check for
 * @return  boolean  whether the character is an hexadecimal digit or not
 */
function PMA_STR_isHexDigit($c)
{
    $ord_Aupper = 65;
    //ord('A');
    $ord_Fupper = 70;
    //ord('F');
    $ord_Alower = 97;
    //ord('a');
    $ord_Flower = 102;
    //ord('f');
    $ord_zero = 48;
    //ord('0');
    $ord_nine = 57;
    //ord('9');
    $ord_c = ord($c);
    return PMA_STR_numberInRangeInclusive($ord_c, $ord_zero, $ord_nine) || PMA_STR_numberInRangeInclusive($ord_c, $ord_Aupper, $ord_Fupper) || PMA_STR_numberInRangeInclusive($ord_c, $ord_Alower, $ord_Flower);
}
Example #2
0
/**
 * Checks if a character is an accented character
 *
 * @note    Presently this only works for some character sets. More work
 *          may be needed to fix it.
 *
 * @param   string   character to check for
 *
 * @return  boolean  whether the character is an upper alphabetic one or
 *                   not
 *
 * @see     PMA_STR_numberInRangeInclusive()
 */
function PMA_STR_isAccented($c)
{
    $ord_min1 = 192;
    //ord('A');
    $ord_max1 = 214;
    //ord('Z');
    $ord_min2 = 216;
    //ord('A');
    $ord_max2 = 246;
    //ord('Z');
    $ord_min3 = 248;
    //ord('A');
    $ord_max3 = 255;
    //ord('Z');
    $ord_c = ord($c);
    return PMA_STR_numberInRangeInclusive($ord_c, $ord_min1, $ord_max1) || PMA_STR_numberInRangeInclusive($ord_c, $ord_min2, $ord_max2) || PMA_STR_numberInRangeInclusive($ord_c, $ord_min2, $ord_max2);
}