
Code
Public Function GetBytesSubChar(ByVal s As String, ByVal CharCount As Integer) As String
Dim strRtn As String = ""
Dim bytArray() As Byte
Dim chrArray() As Char
Dim intI As Integer
bytArray = System.Text.Encoding.Default.GetBytes(s)
If CharCount > System.Text.Encoding.Default.GetCharCount(bytArray) Then
strRtn = s
Else
chrArray = System.Text.Encoding.Default.GetChars(bytArray, 0, CharCount)
For intI = 0 To chrArray.Length - 1
strRtn = strRtn & chrArray(intI)
Next
End If
Return strRtn
End Function
posted on 2008-11-21 09:03
caizhiyuan 阅读(500)
评论(0) 编辑 收藏 网摘