我找到了這樣一段處理方法,希望對(duì)你有所幫助:
創(chuàng)新互聯(lián)是一家專注于網(wǎng)站設(shè)計(jì)制作、成都網(wǎng)站建設(shè)與策劃設(shè)計(jì),西吉網(wǎng)站建設(shè)哪家好?創(chuàng)新互聯(lián)做網(wǎng)站,專注于網(wǎng)站建設(shè)10年,網(wǎng)設(shè)計(jì)領(lǐng)域的專業(yè)建站公司;建站業(yè)務(wù)涵蓋:西吉等地區(qū)。西吉做網(wǎng)站價(jià)格咨詢:18982081108
枚舉類型如下:
Public Enum ConcertCode
BEIJING
SHANGHAI
GUANGZHOU
End Enum
如果要將比如“beijing”字符串轉(zhuǎn)換為ConcertCode.BEIJING的話,可以通過如下方法:
Dim c As ConcertCode = CType(Enum.Parse(Type.GetType(ConcertCode),字符串的變量,True), ConcertCode)
明白你的意思了,只要是字母都會(huì)轉(zhuǎn)換成數(shù)字,幫你寫好了("usernane"和 "pasward" 我這里寫成 "username" 和" password")
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim username, password As String
Dim temp As Long
Dim r As String = ""
Dim v As String = TextBox1.Text
For Each c In v.ToString
If IsNumeric(c) Then
r = c
Else
r = ((Asc(c) - 65).ToString("00"))
End If
Next
username = r
temp = username * 3 - 500
password = CStr(temp)
TextBox2.Text = password
End Sub
在VB.NET中如果需要將一個(gè)字符串轉(zhuǎn)換成字節(jié)數(shù)組,可以使用System.Text命名空間中某個(gè)編碼對(duì)象的GetBytes方法。
Dim strText As String = "This is an original string"
numHex =Integer.Parse(strHex, Globalization.NumberStyles.AllowHexSpecifier)
或
numHex = Integer. Parse("H" strHex)