2008年6月13日 星期五

只去除空白列

Public Class Form1
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
         Dim str1 = "明" & vbNewLine & vbNewLine & "天會" & vbNewLine & "更好"
        MsgBox(str1)
        '去除所有跳行控制碼
        str1 = Replace(str1, vbNewLine, "")
        MsgBox(str1)
        '只去除空白列
        str1 = "明" & vbNewLine & vbNewLine & "天會" & vbNewLine & "更好"
        str1 = Replace(str1, vbNewLine, "*")
        str1 = Replace(str1, "**", "*")
        str1 = Replace(str1, "*", vbNewLine)
        MsgBox(str1)
    End Sub
End Class

沒有留言: