- UID
- 2
注册时间2004-12-1
阅读权限255
最后登录1970-1-1
总坛主
TA的每日心情 | 开心 2024-12-1 11:04 |
---|
签到天数: 12 天 [LV.3]偶尔看看II
|
发表于 2007-5-3 00:01:47
|
显示全部楼层
这样吧?
- Private Sub Command1_Click()
- '先去除空格,然后每次取4位,每2位中间插入空格
- Dim strin, temp, strout As String
- Dim i As Integer
- strin = htrim(Text2.Text)
- If strin <> "" Then
- For i = 1 To 21
- temp = Mid(strin, i * 2 - 1, 4)
- strout = strout & Left(temp, 2) & " " & Right(temp, 2) & Chr(13) & Chr(10)
- Next
- Text1.Text = strout
- End If
- End Sub
- Function htrim(ByVal str As String) As String '处理字符串
- Dim lenth As Integer
- lenth = Len(str)
- Dim i As Integer
- Dim char As Integer
- Dim s As String
- For i = 1 To lenth
- char = Asc(Mid(str, i, 1))
- If char <> 0 And char <> 32 And char <> 10 And char <> 13 Then
- s = s & Mid(str, i, 1)
- End If
- Next i
- htrim = s
- End Function
复制代码 |
|