home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1993 #2 / Image.iso / clipper / nettos11.zip / MISC / NONULL.PRG < prev    next >
Text File  |  1993-02-23  |  1KB  |  62 lines

  1. /*
  2.  * File......: NONULL.PRG
  3.  * Author....: Steven Tyrakowski
  4.  * CIS ID....: 
  5.  * Date......: $Date$
  6.  * Revision..: $Revision$
  7.  * Log file..: $Logfile$
  8.  * 
  9.  * This is an original work by various Netware API group participants
  10.  * and is placed in the public domain.
  11.  *
  12.  * Modification history:
  13.  * ---------------------
  14.  *
  15.  * $Log$
  16.  *
  17.  */
  18.  
  19. #include "netto.ch"
  20.  
  21. /*  $DOC$
  22.  *  $FUNCNAME$
  23.  *     fn_noNull()
  24.  *  $CATEGORY$
  25.  *     Miscellaneous
  26.  *  $ONELINER$
  27.  *     Strip a string of trailing nulls
  28.  *  $SYNTAX$
  29.  *
  30.  *     fn_noNull( cStr ) -> cNewStr
  31.  *
  32.  *  $ARGUMENTS$
  33.  *
  34.  *     <cStr> - The string to be stripped of nulls
  35.  *
  36.  *  $RETURNS$
  37.  *
  38.  *     <cNewStr> 
  39.  *
  40.  *  $DESCRIPTION$
  41.  *
  42.  *     Given a string <cStr>, fn_noNull() strips any trailing NULLs,
  43.  *     [ chr(0) ] from the end.  If there are no nulls, the entire
  44.  *     string is returned.
  45.  *
  46.  *  $EXAMPLES$
  47.  *
  48.  *  $SEEALSO$
  49.  *
  50.  *  $END$
  51.  */
  52.  
  53.  
  54. function fn_noNull( cVar )
  55.   local pos := at( chr(0), cVar )
  56.  
  57.   if pos > 0
  58.     cVar := substr( cVar, 1, pos - 1 )
  59.   endif
  60.  
  61.   return cVar
  62.