程序代码: | [ 复制代码 ] |
'******************************************************************************************************
'http://www.cnng.net
'石陆软件屋
'函数:CutString(s,10)
'功能:将字符串按等宽的比列换行输出
'调用:CutString("123456789",3)
'参数:Str:待截取的字符串,BrN:换行的字符个数
'******************************************************************************************************
Public Function CutString(str As String, BrN As Integer) As String
Dim n As Integer
Dim s1 As String
n = Len(str)
s1 = ""
s2 = ""
For i = 1 To n
If i Mod BrN = 0 Then
s1 = Left(str, BrN)
str = Replace(str, s1, "")
s2 = s2 & Space(2) & s1 & Chr(10)
End If
Next
CutString = s2
End Function
'http://www.cnng.net
'石陆软件屋
'函数:CutString(s,10)
'功能:将字符串按等宽的比列换行输出
'调用:CutString("123456789",3)
'参数:Str:待截取的字符串,BrN:换行的字符个数
'******************************************************************************************************
Public Function CutString(str As String, BrN As Integer) As String
Dim n As Integer
Dim s1 As String
n = Len(str)
s1 = ""
s2 = ""
For i = 1 To n
If i Mod BrN = 0 Then
s1 = Left(str, BrN)
str = Replace(str, s1, "")
s2 = s2 & Space(2) & s1 & Chr(10)
End If
Next
CutString = s2
End Function
相关链接:vb | 字符串 | 等宽 | 换行输出
[本日志由 admin 于 2013-11-01 10:52 PM 编辑]
引用通告地址 (0):
http://www.cnng.net/blog/trackback.asp?tbID=43
http://www.cnng.net/blog/trackback.asp?tbID=43&CP=GBK
http://www.cnng.net/blog/trackback.asp?tbID=43
http://www.cnng.net/blog/trackback.asp?tbID=43&CP=GBK