home *** CD-ROM | disk | FTP | other *** search
/ Power CD-ROM!! 7 / POWERCD7.ISO / prgmming / clipper / gt_isfie.prg < prev    next >
Text File  |  1993-10-14  |  1KB  |  76 lines

  1. /*
  2.     File......: GT_IsField.prg
  3.     Author....: Martin Bryant
  4.     BBS.......: The Dark Knight Returns
  5.     Net/Node..: 050/069
  6.     User Name.: Martin Bryant
  7.     Date......: 11/03/93
  8.     Revision..: 1.0
  9.  
  10.     This is an original work by Martin Bryant and is placed
  11.     in the public domain.
  12.  
  13.     Modification history:
  14.     ---------------------
  15.  
  16.     Rev 1.0 11/03/93
  17.     PD Revision.
  18. */
  19.  
  20. /*  $DOC$
  21.  *  $FUNCNAME$
  22.  *       GT_ISFIELD()
  23.  *  $CATEGORY$
  24.  *       General
  25.  *  $ONELINER$
  26.  *       Validate a Get for a valid field name.
  27.  *  $SYNTAX$
  28.  *       GT_IsField(<oGet>) -> lSuccess
  29.  *  $ARGUMENTS$
  30.  *       <oGet> Get object.
  31.  *  $RETURNS$
  32.  *       lSuccess
  33.  *  $DESCRIPTION$
  34.  *       Validate a Get for a valid field name.
  35.  *  $EXAMPLES$
  36.  *  $END$
  37.  */
  38.  
  39. #include "GTClippe.ch"
  40.  
  41. FUNCTION GT_IsField(oGet)
  42.  
  43. LOCAL cData := ''
  44. LOCAL cLegal := '1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ_'
  45. LOCAL lSuccess := .T.
  46. LOCAL nCount := 0
  47.  
  48. Default oGet to NIL
  49.  
  50. IF oGet = NIL
  51.  
  52.     lSuccess := .F.
  53.  
  54. ELSE
  55.  
  56.     cData := ALLTRIM(UPPER(EVAL(oGet:Block)))
  57.     nCount := 1
  58.     DO WHILE nCount <= LEN(cData) .AND. lSuccess
  59.  
  60.         // ?
  61.         lSuccess := SUBSTR(cData,nCount++,1) $ cLegal
  62.  
  63.     ENDDO
  64.  
  65.  
  66. ENDIF
  67.  
  68. IF .NOT. lSuccess
  69.     GT_AskUser('Illegal Name !')
  70. ENDIF
  71.  
  72. /*
  73.     End of GT_IsField()
  74. */
  75. RETURN(lSuccess)
  76.