Trim Function

āĻ¸ā§āĻŸā§āϰāĻŋāĻ‚ āĻāĻ•ā§āϏāĻĒā§āϰ⧇āĻļāύ⧇āϰ āϏāĻŦāĻšā§‡ā§Ÿā§‡ āϏāĻžāĻŽāύ⧇āϰ āĻāĻŦāĻ‚ āĻļ⧇āώ⧇āϰ āĻĢāĻžāρāĻ•āĻž āĻ¸ā§āĻĨāĻžāύ āĻ…āĻĒāϏāĻžāϰāĻŖ āĻ•āϰāĻž āĻšā§ŸāĨ¤

Syntax:


Trim( Text As String )

Return value:

String

Parameters:

āĻŸā§‡āĻ•ā§āϏāϟ: āϝ⧇ āϕ⧋āύ āĻ¸ā§āĻŸā§āϰāĻŋāĻ‚ āĻāĻ•ā§āϏāĻĒā§āϰ⧇āĻļāύāĨ¤

Error codes:

5 Invalid procedure call

Example:


Sub ExampleSpaces
Dim sText2 As String,sText As String,sOut As String
    sText2 = " <*Las Vegas*> "
    sOut = "'"+sText2 +"'"+ Chr(13)
    sText = Ltrim(sText2) ' sText = "<*Las Vegas*> "
    sOut = sOut + "'"+sText +"'" + Chr(13)
    sText = Rtrim(sText2) ' sText = " <*Las Vegas*>"
    sOut = sOut +"'"+ sText +"'" + Chr(13)
    sText = Trim(sText2) ' sText = "<*Las Vegas*>"
    sOut = sOut +"'"+ sText +"'"
    MsgBox sOut
End Sub

Please support us!