Hel*_*len 10
此函数从字符串中删除所有前导空格(空格,制表符等):
Function LTrimEx(str)
Dim re
Set re = New RegExp
re.Pattern = "^\s*"
re.Multiline = False
LTrimEx = re.Replace(str, "")
End Function
Run Code Online (Sandbox Code Playgroud)
小智 9
对于多行字符串中的左右修剪(包括制表符,回车符,换行符,空格),这将起作用.
Function MultilineTrim (Byval TextData)
Dim textRegExp
Set textRegExp = new regexp
textRegExp.Pattern = "\s{0,}(\S{1}[\s,\S]*\S{1})\s{0,}"
textRegExp.Global = False
textRegExp.IgnoreCase = True
textRegExp.Multiline = True
If textRegExp.Test (TextData) Then
MultilineTrim = textRegExp.Replace (TextData, "$1")
Else
MultilineTrim = ""
End If
End Function
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
23857 次 |
| 最近记录: |