富贵资源网 Design By www.hznty.com

复制代码 代码如下:
function zhen(str) { 
    var arr_1 = ["", "\u62fe", "\u4f70", "\u4edf", "\u4e07", "\u4ebf"], arr_2 = ["", "\u4e07", "\u4ebf"]; 
    var maskstr = arr_1.slice(1).join(""); 
    var arr2 = ["\u96f6", "\u58f9", "\u8d30", "\u53c1", "\u8086", "\u4f0d", "\u9646", "\u67d2", "\u634c", "\u7396"]; 
    var arr3 = new Array; 
    var arr = str.split(""); 
    arr.reverse(); 
    var _step_ = 4; 
    var _index_ = 0; 
    var int1 = 0, int2 = 0; 
    // var  
    for (var i = 0; i < arr.length; i++) { 
        _index_ = i; 
        int1 = _index_ % _step_; 
        int2 = parseInt(_index_ / _step_); 
        if (int2 > 0 & int1 == 0) { 
            if (maskstr.indexOf(arr3[arr3.length - 1]) != -1) { 
                arr3.pop(); 
            } 
            arr3.push(arr_2[int2]); 
        } 
        if (arr[i] > 0) { 
            if (int1 > 0) { 
                arr3.push(arr_1[int1]); 
            } 
        } 
        arr3.push(arr2[arr[i]]); 
    } 
    arr3.reverse(); 
    <SPAN style="FONT-FAMILY: Consolas, 'Lucida Console', monospace; WHITE-SPACE: pre-wrap; COLOR: rgb(0,128,255)">return arr3.join("");</SPAN> 


测试:

zhen('12345');

->"壹万贰仟叁佰肆拾伍"

富贵资源网 Design By www.hznty.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
富贵资源网 Design By www.hznty.com