home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 5 / 05.iso / a / a075 / 1.img / TOOLKIT1.EXE / SST93.PRG < prev    next >
Encoding:
Text File  |  1989-08-08  |  685 b   |  28 lines

  1. *******************
  2.  
  3. FUNCTION Hexideci
  4.  
  5.    PARAMETERS _thenum
  6.  
  7.    IF EMPTY(PCOUNT())
  8.       RETURN(-1)
  9.    ENDIF
  10.    IF TYPE("_thenum") != "C"
  11.       RETURN(-1)                     && For the Larry Josephson's of 
  12.    ELSE                              && the world. Argh!!!
  13.       _thenum = LTRIM(TRIM(_thenum)) && Just in case!
  14.    ENDIF
  15.  
  16.    PRIVATE _retval, _count, _qaz, _thechar
  17.  
  18.    _retval = 0
  19.    _count = 1
  20.    FOR _qaz = LEN(_thenum) TO 1 STEP -1
  21.        _thechar = AT(SUBSTR(_thenum, _qaz, 1), "0123456789ABCDEF") - 1
  22.       _retval = _retval + (_thechar * ( 16 ** (_count - 1) ))
  23.       _count = _count + 1
  24.    NEXT
  25.    RETURN(WHOLENUM(_retval))
  26.  
  27. * End of File
  28.