vb.net汉字内码排序 vb字母顺序代码

汉字机内码

1-126为英文字符等

成都创新互联成立与2013年,先为苏家屯等服务建站,苏家屯等地企业,进行企业商务咨询服务。为苏家屯企业网站制作PC+手机+微官网三网同步一站式服务解决您的所有建站问题。

33088-41214是汉字(按拼音排序)

41378-41982是各种字符

42145-42993是其它国家字符(日、俄、韩、希腊等)

43072-43157是符号

43169-43508是汉语拼音相关及一些符号

43584-65184是汉字(按部首排序)

你可以运行下面程序代码:

Private Sub Command1_Click()

Open "c:\zf.txt" For Append As #1

For i = 1 To 65535

Print #1, i, ": "; Chr(i)

Next i

Close #1

End Sub

只需不到一秒,所有字符就会形成一个文件zf.txt放到c盘根目录下。

更多VB代码请关注我的博客:

通过vb如何实现按中文词语拼音的首字母排序?

给你2段代码:其中一段是别人写的转换拼音首字母的函数,网上也有这样的控件,但不想用控件的话就用这段代码

'在窗口中加两个TEXT控件,一个输入中文,一个显示英文

Private Sub Form_Load()

Text1.Text = "转汉语拼音"

End Sub

Private Sub Command1_Click()

Text2.Text = GetPY(Text1.Text)

End Sub

'获得输入名称的首字拼音

Private Function GetPY(ByVal strParmeter As String) As String

Dim intTmp As String, i As Long

intTmp = Asc(Mid(strParmeter, 1, 1))

If intTmp Asc("啊") Then

GetPY = GetPY "*"

ElseIf intTmp = Asc("啊") And intTmp Asc("芭") Then

GetPY = GetPY "A"

ElseIf intTmp = Asc("芭") And intTmp Asc("擦") Then

GetPY = GetPY "B"

ElseIf intTmp = Asc("擦") And intTmp Asc("搭") Then

GetPY = GetPY "C"

ElseIf intTmp = Asc("搭") And intTmp Asc("蛾") Then

GetPY = GetPY "D"

ElseIf intTmp = Asc("蛾") And intTmp Asc("发") Then

GetPY = GetPY "E"

ElseIf intTmp = Asc("发") And intTmp Asc("噶") Then

GetPY = GetPY "F"

ElseIf intTmp = Asc("噶") And intTmp Asc("哈") Then

GetPY = GetPY "G"

ElseIf intTmp = Asc("哈") And intTmp Asc("击") Then

GetPY = GetPY "H"

ElseIf intTmp = Asc("击") And intTmp Asc("喀") Then

GetPY = GetPY "J"

ElseIf intTmp = Asc("喀") And intTmp Asc("垃") Then

GetPY = GetPY "K"

ElseIf intTmp = Asc("垃") And intTmp Asc("妈") Then

GetPY = GetPY "L"

ElseIf intTmp = Asc("妈") And intTmp Asc("拿") Then

GetPY = GetPY "M"

ElseIf intTmp = Asc("拿") And intTmp Asc("哦") Then

GetPY = GetPY "N"

ElseIf intTmp = Asc("哦") And intTmp Asc("啪") Then

GetPY = GetPY "O"

ElseIf intTmp = Asc("啪") And intTmp Asc("期") Then

GetPY = GetPY "P"

ElseIf intTmp = Asc("期") And intTmp Asc("然") Then

GetPY = GetPY "Q"

ElseIf intTmp = Asc("然") And intTmp Asc("撒") Then

GetPY = GetPY "R"

ElseIf intTmp = Asc("撒") And intTmp Asc("塌") Then

GetPY = GetPY "S"

ElseIf intTmp = Asc("塌") And intTmp Asc("挖") Then

GetPY = GetPY "T"

ElseIf intTmp = Asc("挖") And intTmp Asc("昔") Then

GetPY = GetPY "W"

ElseIf intTmp = Asc("昔") And intTmp Asc("压") Then

GetPY = GetPY "X"

ElseIf intTmp = Asc("压") And intTmp Asc("匝") Then

GetPY = GetPY "Y"

ElseIf intTmp = Asc("匝") And intTmp 0 Then

GetPY = GetPY "Z"

ElseIf (intTmp = 65 And intTmp = 91) Or (intTmp = 97 And intTmp = 123) Then

GetPY = GetPY Mid(strParmeter, i, 1)

Else

GetPY = GetPY "*"

End If

End Function

'============================

Private Sub Command1_Click()

ar = Split(Text1.Text, vbCrLf)

For i = 0 To UBound(ar)

Print ar(i)

Next

End Sub

'这个是我写的,吧按行来组成数组,根据2段代码加上排序就行了,时间关系我就不做完整了,相信你会看懂

VB 字符串排序

Option Explicit

Private Sub Command1_Click() '排序

Dim i%, j%, S() As String, t As String

ReDim S(Len(Trim(Text1)))

For i = LBound(S) To UBound(S)

S(i) = Mid(Trim(Text1), i + 1, 1)

Next

For i = 0 To UBound(S)

For j = i + 1 To UBound(S)

If S(j) S(i) Then t = S(i): S(i) = S(j): S(j) = t

Next

Text2 = Text2 S(i)

Text2 = Trim(Text2)

Next

End Sub

Private Sub Command2_Click() '读入

Dim Txt As String

Open App.Path "\test12.txt" For Input As #11

Do While Not EOF(11)

Line Input #11, Txt

Text1 = Text1 Txt

Loop

Close #11

End Sub

Private Sub Command3_Click() '追加

Open App.Path "\test12.txt" For Append As #12

Print #12, Text2

Close #12

End Sub


文章题目:vb.net汉字内码排序 vb字母顺序代码
URL分享:http://myzitong.com/article/dogohii.html