Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Trim Trailing Zeros
Message
 
 
To
02/07/2006 14:43:11
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP
Network:
Windows 2000 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01133333
Message ID:
01133334
Views:
14
This message has been marked as the solution to the initial question of the thread.
? RTRIM(" 12340560000 ",0,SPACE(1), "0")
>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
--sb--
Previous
Reply
Map
View

Click here to load this message in the networking platform