Function: ctype_alnum version 84

Function:
Description: Checks for alphanumeric character(s).
Version:
Status: latest
Date: 2011-12-20 04:53
Summary: Import from phpjs.
Programmer: jj5
Code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
function ctype_alnum (text) {
    // http://jsphp.co/jsphp/fn/view/ctype_alnum
    // +   original by: Brett Zamir (http://brett-zamir.me)
    // -    depends on: setlocale
    // *     example 1: ctype_alnum('AbC12');
    // *     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.an) !== -1;
}
[top]

Comments

There are no comments yet, be the first!

Please Login or Register to post comments.