#include once "window9.bi"

Function RtrimA(ByRef sDestString As USTRING, ByRef sTrimString As USTRING) As USTRING Export
	dim as USTRING sRet
	Dim As Integer iLenDestString = Len(sDestString)
	Dim As Integer iLenTrimString = Len(sTrimString)-1
	Dim As Integer iPos = iLenDestString-1
	For i As Integer = iLenTrimString To 0 Step -1
		If sDestString[iPos]=sTrimString[i] Then
			iPos-=1
			i = iLenTrimString+1
			If iPos = 0 Then
				Exit For
			EndIf
		EndIf
	Next
	sRet = Mid(sDestString , 1 , iPos+1)
	Return sRet
End Function


