General information
Category:
Coding, syntax & commands
Title:
Trim Trailing Zeros
Environment versions
Network:
Windows 2000 Server
I am using WinMerge to compare two files that are the result of two different processes. I am seeing a lot of differences but most are associated with one file containing a column with extra (meaningless) zeros (0).
I know I can write a function (using a DO WHILE loop) that will return the value with trailing zeros removed but is there a better, more optimal solution? Here is what I have for now:
?trimit( " 12340560000 " )
FUNCTION trimit( tcx )
LOCAL cRetVal AS String
cRetVal = ALLTRIM( tcx )
DO WHILE .T.
IF RIGHT( m.cRetVal,1 ) = "0"
cRetVal = LEFT( m.cRetVal, LEN( m.cRetVal ) - 1 )
ELSE
EXIT
ENDIF
ENDDO
RETURN m.cRetVal
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only