我编写了这个函数来删除字符串开头和结尾的空格,有什么想法为什么它不起作用?
Public Function PrepareString(TextLine As String)
Do While Left(TextLine, 1) = " " ' Delete any excess spaces
TextLine = Right(TextLine, Len(TextLine) - 1)
Loop
Do While Right(TextLine, 1) = " " ' Delete any excess spaces
TextLine = Left(TextLine, Len(TextLine) - 1)
Loop
PrepareString = TextLine
End Function