PB 十六进制转中文

//本来想在网上找个现成的函数来着,但是找了好长时间也没找到,没办法,自己研究着写了一个,记载一下.

long ll_point,ll_hex,ll_len
ulong ll_value
string ls_pv
string fs_hex
string ls_str,ls_str_mid,ls_str_mid1
string ls_value
long ll_str,i
ls_str =  as_str //'\u540c\u6b65\u6210\u529f'    as_mid = '\'
ll_str = len(ls_str)
ls_str_mid1 = ls_str 
do while pos(ls_str_mid1,as_mid,1) > 0
    ll_value = 0
    ls_str_mid = mid(ls_str_mid1,1,pos(ls_str_mid1,as_mid,2) -1) 
    if ls_str_mid = '' then 
        ls_str_mid =  ls_str_mid1
    end if
    ls_str_mid1 = mid(ls_str_mid1,pos(ls_str_mid1,as_mid,2) ,len(ls_str))
//    messagebox('str1',ls_str_mid1)
//    messagebox('str',ls_str_mid)
    ll_len = len(ls_str_mid)
    for ll_point = ll_len to 1 step -1
        ls_pv = mid(ls_str_mid,ll_point,1)
        choose case ls_pv
            case 'a','A'
                ll_hex = 10
            case 'b','B'
                ll_hex = 11
            case 'c','C'
                ll_hex = 12
            case 'd','D'
                ll_hex = 13
            case 'e','E'
                ll_hex = 14
            case 'f','F'
                ll_hex = 15
            case else
                ll_hex = long(ls_pv)
        end choose
        ll_value = ll_value + ll_hex * 16 ^ (ll_len - ll_point )
    next
    
    if ls_str_mid = ls_str_mid1 then ls_str_mid1 = ''
    ls_value = ls_value + string(char(ll_value))
loop
as_value = ls_value
//messagebox('',ls_value)
return ll_value

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值