十进制转成36进制

有些时候需要很短的几个数字或者字母表示更多的信息,比如条码,普通的十进制就不太够用,比如使用三个字符

如果只用阿拉伯数字的话最多,1000个,,如果加上英文字母则可以表示36*36*36个,只考虑使用大写字母

//====================================================================

// 函数: f_36

//——————————————————————–

// 描述: 十进制(三位)转
36进制(十个阿拉伯数字加26个大写英文字母)

//——————————————————————–

// 参数:

//  value string as_parm

//——————————————————————–

// 返回值:  string

//——————————————————————–

// 作者: 西门坡论坛 friendwaters 日期: 2007.03.25

//——————————————————————–

// 修改历史:

//

//====================================================================

If Len(as_parm) < 3 Then

Else

as_parm = Right(as_parm,3)

End If

Long ll_cnt

String ls_r,ls_a,ls_b,ls_c

Int a,b,c

ll_cnt = Integer(as_parm)

a = ll_cnt/(36*36)

b = (ll_cnt – a*36*36)/36

c = ll_cnt – a*1296 -b*36

If a > 9 Then

a = a +55

ls_a = Char(a)

Else

ls_a = String(a)

End If

If b > 9 Then

b = b +55

ls_b = Char(b)

Else

ls_b = String(b)

End If

If c > 9 Then

c = c +55

ls_c = Char(c)

Else

ls_c = String(c)

End If

ls_r = ls_a + ls_b+ls_c

Return ls_r  

    原文作者:进制转换
    原文地址: https://blog.csdn.net/friendwaters/article/details/1587576
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞