永发信息网

vb text1.text 内容 如何每一行文字后添加个空行

答案:2  悬赏:50  手机版
解决时间 2021-02-13 19:19
  • 提问者网友:美人性情
  • 2021-02-13 12:02
Private Sub Command1_Click()
Randomize Timer
Text1.Text = RndLine(LineFilter(Text1.Text))

End Sub

Function LineFilter(ByRef T As String) As String
Dim L() As String, Le As Long, Ls As Long, Lc() As String, Lcs As Long
L() = Split(T, vbCrLf): Le = UBound(L()): ReDim Lc(Le)
For Ls = 0 To Le
If Not L(Ls) = "" Then
Lc(Lcs) = L(Ls): Lcs = Lcs + 1
End If
Next
ReDim Preserve Lc(Lcs - 1)
LineFilter = Join(Lc, vbCrLf)
End Function

Function RndLine(ByRef T As String) As String
Dim L() As String, Le As Long, Ls As Long, Ld As Long, Lt As String
L() = Split(T, vbCrLf): Le = UBound(L())
For Ls = 0 To Le
Ld = Int(Rnd * (Le + 1))
Lt = L(Ls): L(Ls) = L(Ld): L(Ld) = Lt
Next
RndLine = Join(L, vbCrLf)
End Function

text1.text 是允许多行的,现在是把空行格式化了.

我需要再以上代码完成后 每一行后添加个空行 请问各位大侠怎么弄
最佳答案
  • 五星知识达人网友:一叶十三刺
  • 2021-02-13 13:09
一句话搞定:
text1.text=Replace(text1.VbCrlf,VbCrlf&VbCrlf)
全部回答
  • 1楼网友:往事埋风中
  • 2021-02-13 13:47
rndline = join(l, vbcrlf) 改成 rndline = join(l, vbcrlf & vbcrlf)
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯