以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  请教甜大师  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=53794)

--  作者:hbhb
--  发布时间:2014/7/15 16:46:00
--  请教甜大师
大师:请教如何将“大师您好!”,动态变成“大  师  您  好!” ?
--  作者:Bin
--  发布时间:2014/7/15 16:49:00
--  
Dim s As String = "大师您好!"
Dim str As String
For Each st As String In s
    str += st & " "
Next
MessageBox.show(str)

--  作者:有点甜
--  发布时间:2014/7/15 16:49:00
--  

Dim str As String = "abcefg"
Dim temp As String = ""
For Each s As String In str
    temp &= s & "   "
Next
msgbox(temp.SubString(0, temp.Length - 3))


--  作者:lsy
--  发布时间:2014/7/15 16:57:00
--  

供参考:

 

\'Insert,按指定间隔插入指定长度的字符串:
Dim str As String = "好人32326777e288啦828a88bc6d78901234567890"
InputValue(str,"","请输入原字符串")
Dim s As String
InputValue(s,"","请输入插入字符串")
Dim Int As Integer = 1
InputValue(Int,"","请输入插入间隔长度")
If Int = 0 Then
    Return "除数不能为零"
End If
If str.Length Mod Int = 0 Then
    For i As Integer = Int To (str.Length \\ Int) * (s.Length + Int) - s.Length - 1 Step s.Length + Int
        str = str.Insert(i,s)
    Next
Else
    For i As Integer = Int To (str.Length \\ Int) * (s.Length + Int) - s.Length Step s.Length + Int
        str = str.Insert(i,s)
    Next
End If
str = str.Replace("空"," ")
Output.Show(str)


--  作者:hbhb
--  发布时间:2014/7/15 17:02:00
--  
谢谢!