function autoStrip(s, settings) {
        if (settings.aSign !== '') { /** remove currency sign */
            s = s.replace(settings.aSign, '');
        }
        if (settings.aSuffix) { /** remove suffix */
            while (s.indexOf(settings.aSuffix) > -1) {
                s = s.replace(settings.aSuffix, '');
            }
        }
        s = s.replace(settings.skipFirstAutoStrip, '$1$2'); /** first replace anything before digits */
        if ((settings.pNeg === 's' || (settings.pSign === 's' && settings.pNeg !== 'p')) && s.indexOf('-') > -1 && s !== '') {
            settings.trailingNegative = true;
        }
        s = s.replace(settings.skipLastAutoStrip, '$1'); /** then replace anything after digits */
        s = s.replace(settings.allowedAutoStrip, ''); /** then remove any uninterested characters */
        if (settings.altDec) {
            s = s.replace(settings.altDec, settings.aDec);
        } /** get only number string */
        var m = s.match(settings.numRegAutoStrip);
        s = m ? [m[1], m[2], m[3]].join('') : '';
        if (settings.lZero === 'allow' || settings.lZero === 'keep') {
            var parts = [],
                nSign = '';
            parts = s.split(settings.aDec);
            if (parts[0].indexOf(settings.aNeg) !== -1) {
                nSign = settings.aNeg;
                parts[0] = parts[0].replace(settings.aNeg, '');
            }
            if (nSign === "" && parts[0].length > settings.mIntPos && parts[0].charAt(0) === '0') { /** strip leading zero if need */
                parts[0] = parts[0].slice(1);
            }
            if (nSign !== '' && parts[0].length > settings.mIntNeg && parts[0].charAt(0) === '0') { /** strip leading zero if need */
                parts[0] = parts[0].slice(1);
            }
            s = nSign + parts.join(settings.aDec);
        }
        if ((settings.onOff && settings.lZero === 'deny') || (settings.lZero === 'allow' && settings.onOff === false)) {
            var strip_reg = '^' + settings.aNegRegAutoStrip + '0*(\\d|$)';
            strip_reg = new RegExp(strip_reg);
            s = s.replace(strip_reg, '$1$2');
        }
        return s;
    }
/**
     * strip all unwanted characters and leave only a number alert
     */
strip all unwanted characters and leave only a number alert
strip all unwanted characters and leave only a number alert
function autoStrip(s, settings) {
        if (settings.aSign !== '') { 
            s = s.replace(settings.aSign, '');
        }
        if (settings.aSuffix) { 
            while (s.indexOf(settings.aSuffix) > -1) {
                s = s.replace(settings.aSuffix, '');
            }
        }
        s = s.replace(settings.skipFirstAutoStrip, '$1$2'); 
        if ((settings.pNeg === 's' || (settings.pSign === 's' && settings.pNeg !== 'p')) && s.indexOf('-') > -1 && s !== '') {
            settings.trailingNegative = true;
        }
        s = s.replace(settings.skipLastAutoStrip, '$1'); 
        s = s.replace(settings.allowedAutoStrip, ''); 
        if (settings.altDec) {
            s = s.replace(settings.altDec, settings.aDec);
        } 
        var m = s.match(settings.numRegAutoStrip);
        s = m ? [m[1], m[2], m[3]].join('') : '';
        if (settings.lZero === 'allow' || settings.lZero === 'keep') {
            var parts = [],
                nSign = '';
            parts = s.split(settings.aDec);
            if (parts[0].indexOf(settings.aNeg) !== -1) {
                nSign = settings.aNeg;
                parts[0] = parts[0].replace(settings.aNeg, '');
            }
            if (nSign === "" && parts[0].length > settings.mIntPos && parts[0].charAt(0) === '0') { 
                parts[0] = parts[0].slice(1);
            }
            if (nSign !== '' && parts[0].length > settings.mIntNeg && parts[0].charAt(0) === '0') { 
                parts[0] = parts[0].slice(1);
            }
            s = nSign + parts.join(settings.aDec);
        }
        if ((settings.onOff && settings.lZero === 'deny') || (settings.lZero === 'allow' && settings.onOff === false)) {
            var strip_reg = '^' + settings.aNegRegAutoStrip + '0*(\\d|$)';
            strip_reg = new RegExp(strip_reg);
            s = s.replace(strip_reg, '$1$2');
        }
        return s;
    }
function autoStrip ( s , settings ) { if ( settings . aSign !== '' ) { s = s . replace ( settings . aSign , '' ) ; } if ( settings . aSuffix ) { while ( s . indexOf ( settings . aSuffix ) > - 1 ) { s = s . replace ( settings . aSuffix , '' ) ; } } s = s . replace ( settings . skipFirstAutoStrip , '$1$2' ) ; if ( ( settings . pNeg === 's' || ( settings . pSign === 's' && settings . pNeg !== 'p' ) ) && s . indexOf ( '-' ) > - 1 && s !== '' ) { settings . trailingNegative = true ; } s = s . replace ( settings . skipLastAutoStrip , '$1' ) ; s = s . replace ( settings . allowedAutoStrip , '' ) ; if ( settings . altDec ) { s = s . replace ( settings . altDec , settings . aDec ) ; } var m = s . match ( settings . numRegAutoStrip ) ; s = m ? [ m [ 1 ] , m [ 2 ] , m [ 3 ] ] . join ( '' ) : '' ; if ( settings . lZero === 'allow' || settings . lZero === 'keep' ) { var parts = [ ] , nSign = '' ; parts = s . split ( settings . aDec ) ; if ( parts [ 0 ] . indexOf ( settings . aNeg ) !== - 1 ) { nSign = settings . aNeg ; parts [ 0 ] = parts [ 0 ] . replace ( settings . aNeg , '' ) ; } if ( nSign === "" && parts [ 0 ] . length > settings . mIntPos && parts [ 0 ] . charAt ( 0 ) === '0' ) { parts [ 0 ] = parts [ 0 ] . slice ( 1 ) ; } if ( nSign !== '' && parts [ 0 ] . length > settings . mIntNeg && parts [ 0 ] . charAt ( 0 ) === '0' ) { parts [ 0 ] = parts [ 0 ] . slice ( 1 ) ; } s = nSign + parts . join ( settings . aDec ) ; } if ( ( settings . onOff && settings . lZero === 'deny' ) || ( settings . lZero === 'allow' && settings . onOff === false ) ) { var strip_reg = '^' + settings . aNegRegAutoStrip + '0*(\\d|$)' ; strip_reg = new RegExp ( strip_reg ) ; s = s . replace ( strip_reg , '$1$2' ) ; } return s ; }
strip all unwanted characters and leave only a number alert
strip all unwanted characters and leave only a number alert
/** remove currency sign */ /** remove suffix */ /** first replace anything before digits */ /** then replace anything after digits */ /** then remove any uninterested characters */ /** get only number string */ /** strip leading zero if need */ /** strip leading zero if need */