View: ctype_xdigit

Function:
Description: Checks for character(s) representing a hexadecimal digit.
Code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
function ctype_xdigit (text) {
    // http://jsphp.co/jsphp/fn/view/ctype_xdigit
    // +   original by: Brett Zamir (http://brett-zamir.me)
    // -    depends on: setlocale
    // *     example 1: ctype_xdigit('01dF');
    // *     returns 1: true
    if (typeof text !== 'string') {
        return false;
    }
    // BEGIN REDUNDANT
    this.setlocale('LC_ALL', 0); // ensure setup of localization variables takes place
    // END REDUNDANT
    return text.search(this.php_js.locales[this.php_js.localeCategories.LC_CTYPE].LC_CTYPE.xd) !== -1;
}
Comment on ctype_xdigit version 94
Tests
Benchmark
[top]

Comments

There are no comments yet, be the first!

Please Login or Register to post comments.