home *** CD-ROM | disk | FTP | other *** search
- /*
- Listing 18.28 SQZ()
- Author: Joe Booth
- Excerpted from "Clipper 5: A Developer's Guide"
- Copyright (c) 1991 M&T Books
- 501 Galveston Drive
- Redwood City, CA 94063-4728
- (415) 366-3600
- */
-
-
- function sqz_n(_number,_size,_dec)
- LOCAL tmpstr,retstring:="",k
- _dec := if(_dec=NIL,0,_dec )
- _number := _number * (10**_dec)
- _size := if(_size/2<>int(_size/2),_size+1,_size)
- tmpstr := str( _number,_size)
- tmpstr := strtran(tmpstr," ","0")
- for k = 1 to len(tmpstr) step 2
- retstring=retstring+chr(val(substr(tmpstr,k,2))+100)
- next
- return retstring
-
-
- function unsqz_n(_compressed,_size,_dec)
- LOCAL _tmp:="",k,multi,answer
- _size := if(_size/2<>INT(_size/2),_size+1,_size)
- for k=1 to len(_compressed)
- _tmp=_tmp+str(asc(substr(_compressed,k,1))-100,2)
- next
- _tmp := strtran(_tmp," ","0")
- answer := substr(_tmp,1,_size-_dec)+"."+substr(_tmp,_size-_dec+1)
- return val(answer)
-
- // end of file CHP1828.PRG
-