View Single Post
  #4 (permalink)  
Old 08-30-2007, 09:08 AM
maXim's Avatar
maXim maXim is offline
Senior Member
 
Join Date: May 2007
Location: Florence, Italy
Posts: 156
Send a message via MSN to maXim Send a message via Skype™ to maXim
Awards Showcase
Beta Tester 
Total Awards: 1
Post AllTrim, LTrim and RTrim functions

I have resolved this way:

Code:
Sub fncALLTRIM(xString)
   If StrLength(xString) < 1 Then Return ""
    xs = fncLTRIM(xString)
    xs = fncRTRIM(xs)
    Return xs
End Sub
 
Sub fncLTRIM(xString)
    If StrLength(xString) < 1 Then Return ""
    xs = xString
rLTRIM:
    If StrLength(xs) > 0 Then
         If SubString(xs, 0, 1) = Chr(32) Then
            xs = SubString(xs, 1, StrLength(xs) - 1)
            Goto rLTRIM
         End If
    End If
    Return xs
End Sub
 
Sub fncRTRIM(xString)
    If StrLength(xString) < 1 Then Return ""
    xs = xString
rRTRIM:
    If StrLength(xs) > 0 Then
        If SubString(xs, StrLength(xs) - 1, 1) = Chr(32) Then
          xs = SubString(xs, 0, StrLength(xs) - 1)
            Goto rRTRIM
        End If
    End If
   Return xs
End Sub
this is not the best solution but works!

In my projects, exposed in "Italian Forum", you will find other examples and functions...

Regards.

Last edited by maXim : 08-31-2007 at 10:09 AM.
Reply With Quote