knrt.net
当前位置:首页 >> VB编写 编写一个程序,用来从字符串中筛选出字母字... >>

VB编写 编写一个程序,用来从字符串中筛选出字母字...

'text1 对应你的输入字符串 'text2 对应的反序的字符串 'command1 对应的 分离并反序按钮 'command2 对应的清除按钮 '其中 a 对应的 ascii 码 为97 z 对应的 ascii 码 为122 'A 对应的 ascii 码 为65 Z 对应的 ascii 码 为90 Private Sub Comman...

for i=1 to len(text1.text) str=left(right(text1.text,i),1) Select Case str Case "a" To "z" text2.text=text2.text & str Case "A" To "Z" text2.text=text2.text & str End Select next i

将要删去的字符替换成空即可埃 Replace("abcabcs", "c", "") 返回值就是"abcabcs"去掉了字符"c"的结果"ababs"。

lvweyi 朋友介绍的是VB提供的函数,就是你要的功能! 但是老师要的显然不是这个答案。 text2.text="" for i = Len(text1.text) To 1 step -1 text2.text = text2.text & Mid(text1.text,i,1) next i

Dim ABC(65 To 90) As Integer Dim AB As Integer For i = 1 To Len(Text1) ' AB = Asc(UCase(Mid(Text1, i, 1))) If AB > 64 And AB < 91 Then ABC(AB) = ABC(AB) + 1 '是字母A-Z Next i For j = 65 To 90 Text2 = Text2 & Chr(j) & "=" & ABC(...

Dim S1 As String Dim S2 As String S1 = "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJ" S2 = "abcdefghijklmnopqrstuvwxyzabcdefghij" Dim LStr As String LStr = "AXDCF1245CDxhsavs" '保存原来的文本 Dim TStr As String Dim i As Integer Dim S A...

Private Sub Command1_Click() Dim i As Integer, j As Integer, a As String Text1 = "我我我我我你你你你你你他他他" 'text1输入的字符串,测试使用 a = "我"'检测我出现的次数 For j = 1 To Len(Text1.Text) If Mid(Text1.Text, j, 1) = a Th...

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim a, b As String, c As Integer a = InputBox("input a string", , "abcdefg") b = InputBox("find string", , "g") c = a.I...

Private Sub Command1_Click() n = 0 m = 0 k = 0 l = 0 aa = 0 bb = Text1 Do Until Len(bb) = 0 aa = Asc(bb) bb = Right(bb, Len(bb) - 1) Print aa If 97

使用以下代码即可: s1="APPLE" : s2="" for i=1 to len(s1) s2=mid(s1,i,1) & s2 next i print s2

网站首页 | 网站地图
All rights reserved Powered by www.knrt.net
copyright ©right 2010-2021。
内容来自网络,如有侵犯请联系客服。zhit325@qq.com