home *** CD-ROM | disk | FTP | other *** search
/ HomeWare 14 / HOMEWARE14.bin / prog / ks94an.arj / TO_CHAR.HDR < prev    next >
Text File  |  1994-04-24  |  2KB  |  65 lines

  1. /******************************************************************************
  2.                  The Klipper Library, for CA-Clipper 5.x
  3.         Copyright (c), 1994, Wallace Information Systems Engineering
  4.  
  5. FUNCTION:
  6.  
  7. _To_Char( xValue, xFill ) --> cString
  8.  
  9. PARAMETERS:
  10.  
  11. xValue : Value to be converted to character type
  12. xFill  : Logical - add leading zeros to numerics (Optional, Default = FALSE)
  13.  
  14. SHORT:
  15.  
  16. Convert any data type to string equivalent.
  17.  
  18. DESCRIPTION:
  19.  
  20. _To_Char() accepts any Clipper data type and returns it's character
  21. equivalent representation.
  22.  
  23. In the case of Numeric data, spaces are added to the beginning of the
  24. numeric value to pad to the default length.  This depends upon the
  25. type numeric it is.  Double precision integers occupy 16 places.  For
  26. numeric field data, the length is specified in the file structure.  If
  27. xFill is passed as TRUE, these leading spaces are filled with ZEROS.
  28.  
  29. If xFill is passed as a numeric, then numeric data types are stringified
  30. to that length.  If the length specified in xFill is less than or equal to
  31. the length of the number being converted, the length of the number is
  32. unaffected:
  33.  
  34.  
  35. _To_Char(501,4)  = " 501"
  36. _To_Char(501,3)  = "501"
  37. _To_Char(501,2)  = "501"
  38.  
  39.  
  40. When xFill is numeric, nDec can be specified to control the number of
  41. decimal places retained during conversion.
  42.  
  43. If nDec is not specified, the current SET DECIMALS setting is used.
  44.  
  45. For Logical data types, the return val is a "Y" or "N".
  46.  
  47. Finally, (xValue = NIL) returns ""
  48.  
  49. NOTE:
  50.  
  51.  
  52.  
  53. EXAMPLE:
  54.  
  55. _To_Char(1001)       // "1001"
  56. _To_Char(1001,5)     // " 1001"
  57. _To_Char(1001,8)     // "    1001"
  58.  
  59. _To_Char(date())     // "01/01/93"
  60.  
  61. _To_Char(.F.)        // "N"
  62.  
  63.  
  64. ******************************************************************************/
  65.