'此函數(shù)用于十進(jìn)制到二進(jìn)制
10年積累的網(wǎng)站設(shè)計(jì)、網(wǎng)站建設(shè)經(jīng)驗(yàn),可以快速應(yīng)對客戶對網(wǎng)站的新想法和需求。提供各種問題對應(yīng)的解決方案。讓選擇我們的客戶得到更好、更有力的網(wǎng)絡(luò)服務(wù)。我雖然不認(rèn)識你,你也不認(rèn)識我。但先制作網(wǎng)站后付款的網(wǎng)站建設(shè)流程,更有神農(nóng)架林區(qū)免費(fèi)網(wǎng)站建設(shè)讓你可以放心的選擇與我們合作。
Private Function Bin(Number As Long) As Long
Dim Div_value As String
Do
Div_value = (Number Mod 2) Div_value
Number = Int(Number / 2)
Loop Until Number 2
Bin = Number Div_value
End Function
'此函數(shù)用于二進(jìn)制到十進(jìn)制
Private Function value_Bin(Number As Long) As Long
Dim Temp_value As Long, Cyc As Long
For Cyc = 0 To Len(Str(Number))
If Cyc = Len(Str(Number)) Then
value_Bin = Temp_value + Val(Mid(Str(Number), Cyc, 1))
Exit For
End If
If Cyc 0 Then Temp_value = (Temp_value + Val(Mid(Str(Number), Cyc, 1))) * 2
Next Cyc
End Function
'====寫入以上函數(shù)后轉(zhuǎn)值操作:
'十進(jìn)制到十六進(jìn)制:Hex(十進(jìn)制數(shù)值)
'十進(jìn)制到八進(jìn)制:Oct(十進(jìn)制數(shù)值)
'十進(jìn)制到二進(jìn)制:Bin(十進(jìn)制數(shù)值)
'二進(jìn)制到十進(jìn)制:value_Bin(二進(jìn)制數(shù)值)
'八進(jìn)制到十進(jìn)制:Val("O" 八進(jìn)制數(shù)值)
'十六進(jìn)制到十進(jìn)制:Val("H" 十六進(jìn)制數(shù)值)
比如
msgbox DEC_to_BIN(10)
就會返回一個(gè)10轉(zhuǎn)換為十進(jìn)制后的結(jié)果
或者簡單點(diǎn)就用
VB自帶函數(shù):
十進(jìn)制轉(zhuǎn)八進(jìn)制:Oct(num)
十六進(jìn)制轉(zhuǎn)八進(jìn)制:oct("H" num)
十進(jìn)制轉(zhuǎn)十六進(jìn)制:hex(num)
八進(jìn)制轉(zhuǎn)十六進(jìn)制:hex("O" num)
十六進(jìn)制轉(zhuǎn)換為十進(jìn)制
Dim str As String
str = Text2.Text
Text10.Text = CLng("H" str)
Private?Sub?Form1_Load(ByVal?sender?As?System.Object,?ByVal?e?As?System.EventArgs)?Handles?MyBase.Load
MsgBox(DEC_to_HEX(255))
End?Sub
Public?Function?DEC_to_HEX(ByVal?Dec?As?Long)?As?String
Dim?a?As?String
DEC_to_HEX?=?""
Do?While?Dec??0
a?=?CStr(Dec?Mod?16)
Select?Case?a
Case?"10"?:?a?=?"A"
Case?"11"?:?a?=?"B"
Case?"12"?:?a?=?"C"
Case?"13"?:?a?=?"D"
Case?"14"?:?a?=?"E"
Case?"15"?:?a?=?"F"
End?Select
DEC_to_HEX?=?a??DEC_to_HEX
Dec?=?Dec?\?16
Loop
End?Function
下面代碼就是將文本框中以一個(gè)空格隔開的十六進(jìn)制轉(zhuǎn)為字節(jié)的代碼,文本框中數(shù)字格式為:01 02 03
Dim TestArray() As String = Split(TextBox1.Text)
Dim hexBytes() As Byte
ReDim hexBytes(TestArray.Length - 1)
Dim i As Integer
For i = 0 To TestArray.Length - 1
hexBytes(i) = Val("h" TestArray(i))
Next
SerialPort.Write(hexBytes, 0, hexBytes.Length)
Dim s As String = "h" Hex(Asc(Val(InputBox("輸入數(shù)值", "提示", 1))))
MsgBox(s)
#讀取上次檢查到的行數(shù)
last_line=`cat ./mailinfo`
echo "上次行數(shù):"$last_line
#算出本次alert日志的行數(shù)
current_line=`wc -l $alert_log|awk '{print $1}'`
echo "本次行數(shù):"$current_line
#取上次行數(shù)和本次行數(shù)之間的alert日志內(nèi)容,然后把ORA錯(cuò)誤及上下三行放到mailinfo中
文章題目:vb.nethex的簡單介紹
URL鏈接:http://jinyejixie.com/article28/doseccp.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供域名注冊、服務(wù)器托管、企業(yè)建站、營銷型網(wǎng)站建設(shè)、響應(yīng)式網(wǎng)站、網(wǎng)站策劃
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)