home *** CD-ROM | disk | FTP | other *** search
/ DOS Wares / doswares.zip / doswares / DATABASE / DBASE5 / CUA_SAMP.ZIP / FLDSTR.PRG < prev    next >
Encoding:
Text File  |  1994-06-24  |  1.5 KB  |  54 lines

  1. *.............................................................................
  2. *
  3. *   Program Name: FLDSTR.PRG          Copyright: Borland International
  4. *   Date Created: 02/17/94             Language: dBASE 5.0
  5. *   Time Created: 19:47:49               Author: Borland dBASE R&D
  6. *   /brief/library.src
  7. *.............................................................................
  8.  
  9.  
  10. FUNCTION FldStr
  11. PARAMETERS pcField
  12. *----------------------------------------------------------------------------
  13. * NAME
  14. *   FldStr() - Return a field string with type
  15. *
  16. * DESCRIPTION
  17. *   FldStr() appends the field type and length for character and
  18. *   numeric fields in square brackets.
  19. *
  20. * PARAMETERS
  21. *   pcField    = field name as a string
  22. *
  23. * DEPENDENCIES
  24. *   DBF for the field must be active.  If not, field is returned intact.
  25. *
  26. *----------------------------------------------------------------------------
  27.   PRIVATE cType, cField, cNumber, cLen, cExp, cFieldName
  28.  
  29.   cType = TYPE( pcField )
  30.   cFieldName = TRIM( pcField )
  31.   DO CASE
  32.     CASE cType = "C"
  33.       cLen = LTRIM( STR( LEN( &cFieldName ) ) )
  34.       cExp = ' [C' + cLen + ']'
  35.     CASE cType $ "NF"
  36.       cNumber = TRANSFORM( &cFieldName, "@L" )
  37.       cLen = LTRIM( STR( LEN( cNumber ) ) )
  38.       cExp = ' [' + cType + cLen + ']'
  39.     CASE cType = "D"
  40.       cExp = ' [D]'
  41.     CASE cType = "M"
  42.       cExp = ' [M]'
  43.     CASE cType = "L"
  44.       cExp = ' [L]'
  45.     OTHERWISE
  46.       cExp = ''
  47.   ENDCASE
  48.  
  49. RETURN( cFieldName + cExp )
  50. *-- EOF: FldStr( pcField )
  51.  
  52.  
  53.  
  54.