API: alphanumeric
Source:
utils/alphanumeric.ts
Transforms a string to an alphanumeric sequence, stripping non-conformant characters for it. @param string {String} the string to transform
Usage
import { alphanumeric } from "sdk/utils";
import { response } from "sdk/http";
response.println(alphanumeric.toAlphanumeric("@mystring123!#="));
response.flush();
response.close();Classes
Alphanumeric
Transforms a string to an alphanumeric sequence, stripping non-conformant characters for it.
@param string {String} the string to transform
Methods
toAlphanumeric
toAlphanumeric (string:string):stringTransforms a string to an alphanumeric sequence, stripping non-conformant characters for it.
@param string {String} the string to transform
randomString
randomString (length:number, charset:string):stringGenerates a random alphanumeric sequence with the specified length
@param length {Integer} Defaults to 4
alphanumeric
alphanumeric (length:number, lowercase:boolean):stringGenerates a random alphanumeric sequence with the specified length
@param length {Integer} Defaults to 4
@param lowercase {Boolean} Defaults to true
alpha
alpha (length:number, lowercase:boolean):stringGenerates a random ASCII sequence with the specified length
@param length {Integer} Defaults to 4
@param lowercase {Boolean} Defaults to true
numeric
numeric (length:number):stringGenerates a random numeric value
@param length {Integer} Defaults to 4
isNumeric
isNumeric (str:string):booleanTests is the provided
strargument is a valid numeric sequence.
@param str {String} the string to test
isAlphanumeric
isAlphanumeric (str:string):booleanTests is the provided
strargument is a valid alphanumeric sequence.
@param str {String} the string to test