用VB怎么给一个字符串中每个字母之间加上空格?在线等!谢谢!
2个回答
展开全部
....这么长的函数? 有没有必要啊
把这个代码加到Command(按钮) 的单击事件
Dim StrA, TempStr As String, Fx As Long
StrA = "asdfzxcvqwer" '你要插入空格的字符串
For Fx = 1 To Len(StrA) '循环插入.
TempStr = TempStr & Mid(StrA, Fx, 1)
If Fx <> Len(StrA) Then TempStr = TempStr & " " '不要在最后加入空格.
Next
Print TempStr
把这个代码加到Command(按钮) 的单击事件
Dim StrA, TempStr As String, Fx As Long
StrA = "asdfzxcvqwer" '你要插入空格的字符串
For Fx = 1 To Len(StrA) '循环插入.
TempStr = TempStr & Mid(StrA, Fx, 1)
If Fx <> Len(StrA) Then TempStr = TempStr & " " '不要在最后加入空格.
Next
Print TempStr
展开全部
Private Function AddSp(ByVal str As String) As String
Dim Lstr As Long
Dim i As Long
Dim temp() As String * 1
Lstr = Len(str)
If Lstr - 1 < 1 Then AddSp = str: Exit Function
ReDim temp(1 To Lstr) As String * 1
For i = 1 To Lstr
temp(i) = Mid(str, i, 1)
Next
AddSp = temp(1)
For i = 2 To Lstr
AddSp = AddSp & " " & temp(i)
Next
End Function
我给你做了个加空格的函数,怎么调用因该会吧
Dim Lstr As Long
Dim i As Long
Dim temp() As String * 1
Lstr = Len(str)
If Lstr - 1 < 1 Then AddSp = str: Exit Function
ReDim temp(1 To Lstr) As String * 1
For i = 1 To Lstr
temp(i) = Mid(str, i, 1)
Next
AddSp = temp(1)
For i = 2 To Lstr
AddSp = AddSp & " " & temp(i)
Next
End Function
我给你做了个加空格的函数,怎么调用因该会吧
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询