udfStrTrimTail (sString)
;------------------------------------------------------------------------------------------------------------------------------------------
If ItemLocate("udfstrtrimhead",IntControl(77,103,0,0,0),@TAB) Then Goto skip_udfstrtrimhead
#DefineFunction udfStrTrimHead (sString)
sLen=StrLen(sString)
For iPos=1 To sLen
sChar=StrSub(sString,iPos,1)
If sChar==" " Then Continue
If sChar==@TAB Then Continue
Break
Next
Return (StrSub(sString,iPos,-1))
#EndFunction
:skip_udfstrtrimhead
;------------------------------------------------------------------------------------------------------------------------------------------
;------------------------------------------------------------------------------------------------------------------------------------------
If ItemLocate("udfstrtrimtail",IntControl(77,103,0,0,0),@TAB) Then Goto skip_udfstrtrimtail
#DefineFunction udfStrTrimTail (sString)
sLen=StrLen(sString)
For iPos=sLen To 1 By -1
sChar=StrSub(sString,iPos,1)
If sChar==" " Then Continue
If sChar==@TAB Then Continue
Break
Next
Return (StrSub(sString,1,iPos))
#EndFunction
:skip_udfstrtrimtail
;------------------------------------------------------------------------------------------------------------------------------------------
;--- test ---
sStringIn = " 1 2 3 test %@TAB% "
sStringOut = udfStrTrimHead (sStringIn)
sMsgTitle = "Demo udfStrTrimHead (sString)"
sMsgText = StrCat('StringIn',@TAB,'= "',sStringIn,'"',@CRLF,'StringOut',@TAB,'= "',sStringOut,'"')
Message(sMsgTitle,sMsgText)
sStringOut = udfStrTrimTail (sStringIn)
sMsgTitle = "Demo udfStrTrimTail (sString)"
sMsgText = StrCat('StringIn',@TAB,'= "',sStringIn,'"',@CRLF,'StringOut',@TAB,'= "',sStringOut,'"')
Message(sMsgTitle,sMsgText)
Exit
;------------------------------------------------------------------------------------------------------------------------------------------
;*EOF*