汉字字符内码查询_VB小程序,字符与内码

VB小程序,关注我有更多的有趣的VB小程序

1、字符的十进制内码

控件:一个TextBox文本框,一个ListBox列表框,一个CommandButton命令按钮

界面:

90c0149f60fc32f7100cd215bd38ce15.png

代码:

Private Sub Command1_Click()

Dim s As String, ch As String

Dim i As Integer, n As Integer

s = Text1.Text

For i = 1 To Len(s)

ch = Mid(s, i, 1)

n = Asc(ch)

List1.AddItem ch & "内码为:" & Str(n)

Next i

End Sub

2、单词查询

控件:两个TextBox文本框,一个ListBox列表框,一个CommandButton命令按钮

界面:

893de85f1b535c71e66880021be36761.png

代码:

Private Sub Command1_Click()

Dim s As String, tmp As String, c As String

Dim n As Integer, i As Integer

Dim flag As Boolean, cnt As Integer

s = Text1.Text

n = Len(s)

flag = False

List1.Clear

For i = 1 To n

c = Mid(s, i, 1)

If c >= "a" And c <= "z" Or c >= "A" And c <= "Z" Then

tmp = tmp + c

If c = Text2.Text Then flag = True: cnt = cnt + 1

Else

If flag Then List1.AddItem tmp

tmp = ""

flag = False

End If

Next i

If cnt = 0 Then

List1.AddItem "找不到合适的单词。"

End If

End Sub

Private Sub Form_Load()

Text1.Text = "请输入英文短句:"

End Sub

想得到更多的VB小程序,请关注我,点击下方的广告可以更好的支持和鼓励我哦!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值