
vb去除text1.text内容中空格后面字符串
比如说text1.text=111222aaabbbccc自动去除空格和aabbbccc输出111222text1.text内容不固定,但中间都有空格,麻烦高手解决下,小...
比如说text1.text=111222 aaabbbccc
自动去除空格和aabbbccc
输出111222
text1.text内容不固定,但中间都有空格,麻烦高手解决下,小弟感激不尽 展开
自动去除空格和aabbbccc
输出111222
text1.text内容不固定,但中间都有空格,麻烦高手解决下,小弟感激不尽 展开
3个回答
展开全部
if instr(text1.text," ")>0 then
text1.text=replace(text1.text," ","")
end if
追问
不行啊,显示只是去掉了空格并没有把空格后面的内容一起删掉
追答
if instr(text1.text," ")>0 then
text1.text=split(text1.text," ")(0)
end if
展开全部
Private Sub Command1_Click()
Dim str As String
str = "123 321"
p = InStr(str, " ")
Me.Caption = Mid(str, 1, p - 1)
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
先自定义个函数
然后调用
function ntiqi(str)
i = len(str)
for j = 1 to i
temp = mid(str,j,1)
if temp like [0-9] then
ntiqi = ntiqi & temp
end if
next
if ntiqi <> "" then ntiqi = ntiqi * 1 ' 转化为数字格式需要就用,不用就删了
end function
然后调用
function ntiqi(str)
i = len(str)
for j = 1 to i
temp = mid(str,j,1)
if temp like [0-9] then
ntiqi = ntiqi & temp
end if
next
if ntiqi <> "" then ntiqi = ntiqi * 1 ' 转化为数字格式需要就用,不用就删了
end function
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询