vb去除text1.text内容中空格后面字符串
答案:3 悬赏:40 手机版
解决时间 2021-11-23 17:06
- 提问者网友:人生佛魔见
- 2021-11-23 03:17
vb去除text1.text内容中空格后面字符串
最佳答案
- 五星知识达人网友:酒醒三更
- 2021-11-23 03:35
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
text1.text=replace(text1.text," ","")
end if追问不行啊,显示只是去掉了空格并没有把空格后面的内容一起删掉追答if instr(text1.text," ")>0 then
text1.text=split(text1.text," ")(0)
end if
全部回答
- 1楼网友:杯酒困英雄
- 2021-11-23 04:58
Private Sub Command1_Click()
Dim str As String
str = "123 321"
p = InStr(str, " ")
Me.Caption = Mid(str, 1, p - 1)
End Sub
Dim str As String
str = "123 321"
p = InStr(str, " ")
Me.Caption = Mid(str, 1, p - 1)
End Sub
- 2楼网友:梦中风几里
- 2021-11-23 04:45
先自定义个函数
然后调用
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
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯