天天看點

TOOLFK工具-線上漢字/字母/人民币/簡繁體轉換工具

本文要推薦的[TOOLFK]線上漢字/字母/人民币/簡繁體轉換工具,提供簡繁體線上轉換、人民币大寫轉換、字母大小寫互轉、漢字轉拼音線上日常使用工具。

網站名稱:ToolFk

網站鏈結:https://www.toolfk.com/

工具連結:https://www.toolfk.com/tool-online-convert

代碼教學

本工具[線上漢字/字母/人民币/簡繁體轉換工具 ]依賴的代碼庫為(可檢視TOOLFK網站源碼進行檢視)

http://www.toollibs.com/togglecase
transverter.js / pinyin_dict_withtone.js / pinyin_dict_polyph / rmb.js / ec-do.js
           

STEP 1 線上漢字轉拼音工具

TOOLFK工具-線上漢字/字母/人民币/簡繁體轉換工具

STEP 2 線上簡繁體線上轉換工具

TOOLFK工具-線上漢字/字母/人民币/簡繁體轉換工具

STEP 3 線上人民币大寫轉換工具

TOOLFK工具-線上漢字/字母/人民币/簡繁體轉換工具

STEP4 線上字母大小寫互轉工具

TOOLFK工具-線上漢字/字母/人民币/簡繁體轉換工具

STEP5

線上轉換工具核心代碼如下

#大小寫互換
function toggles(type){
        var value = togglecase_s.getValue();
        if(value==''){
            return layer.msg(NOT_EMPTY);
        }
        var result = '';
        if(type == 1){
            result = ecDo.toggleCase(value);
        }else if(type==2){
            result = ecDo.firstWordUpper(value);
        }else{
            result = ecDo.firstWordLower(value);
        }
        togglecase_t.setValue(result);
}
#轉RMB
$('.btn_fun_rmb').click(function (e) {
        e.preventDefault();
        var value = rmb_s.getValue();
        console.log("value = =="+value);
        if(value==''){
            return layer.msg(NOT_EMPTY);
        }
        rmb_t.setValue(trans(value));
});

#簡繁互換
function trans(_type){
        var value = trans_s.getValue();
        if(value==''){
            return layer.msg(NOT_EMPTY);
        }
        trans_t.setValue(transverter({
            type:_type,
            str:value
        }));
}
#擷取漢字拼音
function getPinyin(){
        var type = parseInt($('input[name="pinyin_option"]:checked').val());
        var isStartDuoyin = $('input[name="start_duoyin"]:checked').val() ? true : false;

        var text = $.trim(pinyin_s.getValue());
        if(text == ''){
            layer.msg(NOT_EMPTY);
            return;
        }
        var result = '';
        switch (type){
            case 0:
                result = pinyinUtil.getPinyin(text, ' ', true, isStartDuoyin);
                break;
            case 1:
                result = pinyinUtil.getPinyin(text, ' ', false, isStartDuoyin);
                break;
            case 2:
                result = pinyinUtil.getFirstLetter(text, isStartDuoyin);
                break;
        }

        var html = result;
        if(result instanceof Array)
        {
            html = '';
            result.forEach(function(val,i)
            {
                if(i >= 10)
                    return;
                html += val + "\n\n";
            });
        }
        pinyin_t.setValue(html);
    }