vb 循环结构

qq_44828337 2019-03-25 09:08:51
如何做到筛选text1文本框中输入的字母字符,并反序在text 2中存放?
...全文
189 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
milaoshu1020 2019-03-26
  • 打赏
  • 举报
回复
除了正常比较,也可以用正则表达式:

dim reg
set reg = createobject("vbscript.regexp")
reg.global = true
reg.ignorecase = true
reg.multiline = false
reg.pattern = "[a-zA-Z]"

dim colMatches
set colMatches = reg.execute(Text1)

dim strTemp
strTemp = ""

dim objMatch
for each objMatch in colMatches
strTemp = objMatch.value & strTemp
next

Text2 = strTemp
脆皮大雪糕 2019-03-25
  • 打赏
  • 举报
回复

    Dim i As Long
    Dim strtmp As String
    For i = 1 To Len(Text1.Text)
        If Mid(Text1.Text, i, 1) > "A" Then '这个筛选条件自己去写
            strtmp = Mid(Text1.Text, i, 1) & strtmp '反序
        End If
    Next
    Text2.Text = strtmp

7,763

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧