VB   发布时间:2022-04-03  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了VB 二进制,八进制,十进制,十六进制转换-.NET教程,VB.Net语言大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

public function d_to_b(byval dec as long) as String do d_to_b = dec mod 2 & d_to_b dec = dec / 2 loop while dec end function public function b_to_d(byval bin as String) as Integer dim i as long for i = 1 to len(bin) b_to_d = b_to_d * 2 + val(mid(bin,i,1)) next i end function public function h_to_b(byval hex as String) as String dim i as long dim b as String hex = ucase(heX) for i = 1 to len(heX) SELEct case mid(hex,1) case "0": b = b & "0000" case "1": b = b & "0001" case "2": b = b & "0010" case "3": b = b & "0011" case "4": b = b & "0100" case "5": b = b & "0101" case "6": b = b & "0110" case "7": b = b & "0111" case "8": b = b & "1000" case "9": b = b & "1001" case "a": b = b & "1010" case "b": b = b & "1011" case "c": b = b & "1100" case "d": b = b & "1101" case "e": b = b & "1110" case "f": b = b & "1111" end SELEct next i while left(b,1) = "0" b = right(b,len(b) - 1) wend h_to_b = b end function public function b_to_h(byval bin as String) as String dim i as long dim h as String if len(bin) mod 4 <> 0 then bin = String(4 - len(bin) mod 4,"0") & bin end if for i = 1 to len(bin) step 4SELEct case mid(bin,4) case "0000": h = h & "0" case "0001": h = h & "1" case "0010": h = h & "2" case "0011": h = h & "3" case "0100": h = h & "4" case "0101": h = h & "5" case "0110": h = h & "6" case "0111": h = h & "7" case "1000": h = h & "8" case "1001": h = h & "9" case "1010": h = h & "a" case "1011": h = h & "b" case "1100": h = h & "c" case "1101": h = h & "d" case "1110": h = h & "e" case "1111": h = h & "f" end SELEct next i b_to_h = h end function

大佬总结

以上是大佬教程为你收集整理的VB 二进制,八进制,十进制,十六进制转换-.NET教程,VB.Net语言全部内容,希望文章能够帮你解决VB 二进制,八进制,十进制,十六进制转换-.NET教程,VB.Net语言所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。