好象有個(gè)StrReverse函數(shù)是直接反轉(zhuǎn)字符串的吧..
創(chuàng)新互聯(lián)公司是一家集網(wǎng)站建設(shè),陽(yáng)東企業(yè)網(wǎng)站建設(shè),陽(yáng)東品牌網(wǎng)站建設(shè),網(wǎng)站定制,陽(yáng)東網(wǎng)站建設(shè)報(bào)價(jià),網(wǎng)絡(luò)營(yíng)銷,網(wǎng)絡(luò)優(yōu)化,陽(yáng)東網(wǎng)站推廣為一體的創(chuàng)新建站企業(yè),幫助傳統(tǒng)企業(yè)提升企業(yè)形象加強(qiáng)企業(yè)競(jìng)爭(zhēng)力??沙浞譂M足這一群體相比中小企業(yè)更為豐富、高端、多元的互聯(lián)網(wǎng)需求。同時(shí)我們時(shí)刻保持專業(yè)、時(shí)尚、前沿,時(shí)刻以成就客戶成長(zhǎng)自我,堅(jiān)持不斷學(xué)習(xí)、思考、沉淀、凈化自己,讓我們?yōu)楦嗟钠髽I(yè)打造出實(shí)用型網(wǎng)站。
我平時(shí)用的是VB6.但是.NET中應(yīng)該也是可以用MID的
你注意看FOR 是從len-1到0的..而mid中是不允許出現(xiàn)0的..
你看看MID運(yùn)行不了時(shí),是不是返回I是0的時(shí)間
改成:
For i = Len(sstr) To 1 Step -1
試試了?
字符編碼轉(zhuǎn)換嗎?
1.字符與gb2312(gbk的子集):
Public Function GBKEncode(ByVal sInput As String) As String
Dim ret_GBKEncode As String = ""
Dim i As Integer
Dim startIndex As Integer = 0
Dim endIndex As Integer
Dim x() As Byte = System.Text.Encoding.Default.GetBytes(sInput) '字符以及字符串在vb2008中都是以u(píng)nicode編碼存儲(chǔ)的
endIndex = x.Length - 1
For i = startIndex To endIndex
ret_GBKEncode = "%" Hex(x(i))
Next
Return ret_GBKEncode
End Function
'GBK解碼
Public Function GBKDecode(ByVal sInput As String) As String
sInput = sInput.Replace("%", "")
Dim ret_GBKDecode As String = ""
Dim sLen As Integer = sInput.Length
Dim n As Integer = sLen \ 2
Dim sBytes(0 To n - 1) As Byte
'轉(zhuǎn)化為字節(jié)碼
For i As Integer = 1 To n
sBytes(i - 1) = CByte("H" sInput.Substring(2 * i - 2, 2))
Next
'將字節(jié)碼轉(zhuǎn)化為字符串
ret_GBKDecode = System.Text.Encoding.Default.GetString(sBytes)
Return ret_GBKDecode
End Function
2.Unicode字符串為UTF-8
Imports System.Text
Public Function StringAsUtf8Bytes(ByVal strData As String) As Byte()
Dim bytes() As Byte
bytes = Encoding.UTF8.GetBytes(strData)
Return bytes
End Function
'這里可以類推出好幾種。
VB.NET 整型 i 轉(zhuǎn)化為字符串 s , 字符串 s 轉(zhuǎn)化為字符數(shù)組 CharArr :
Dim i As Integer = 12345
Dim s As String
Dim CharArr As Char()
s = i.ToString()
CharArr = s.ToCharArray()
將 CharArr 數(shù)組反轉(zhuǎn):
Array.Reverse(CharArr)