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

  1. /******************************************************************************
  2.                  The Klipper Library, for CA-Clipper 5.x
  3.         Copyright (c), 1994, Wallace Information Systems Engineering
  4.  
  5. FUNCTION:
  6.  
  7. _StrTempl(cString, cPattern) --> NIL
  8.  
  9. PARAMETERS:
  10.  
  11. cString : String to insert into Template
  12. cPattern: Template to insert string into
  13.  
  14. SHORT:
  15.  
  16. Overlays a string with a template, returning the result string.
  17.  
  18. DESCRIPTION:
  19.  
  20. _StrTempl (String Template) overlays a string with a given template
  21. string, and returns the new string.
  22.  
  23. cString may be any string, but it must match the number of maskable
  24. characters in cPattern.  Maskable characters are SPACES in the
  25. cPattern String!
  26.  
  27. If cPattern = '- - -', then cString must be exactly 2 characters in length.
  28. If cPattern = '...-..-....' (with "." representing spaces), then cString must
  29. be exactly NINE characters in order to be used with that template.
  30.  
  31. NOTE:
  32.  
  33.  
  34.  
  35. EXAMPLE:
  36.  
  37. cSSN = '123456789'
  38.  
  39. t = _StrTempl(cSSN,'   -  -    ')
  40.  
  41. Result: t = "123-45-6789"
  42.  
  43. // cPattern can be pased as variable also:
  44.  
  45. cPatt = '- - - - - - - - - -'
  46.  
  47. t = _StrTempl(cSSN,cPatt)
  48.  
  49. Result: t = "-1-2-3-4-5-6-7-8-9-"
  50.  
  51. cPhone = "9188357109"
  52. t = _StrTemp(cPhone,'(   )   -    ")
  53.  
  54. Result: t = "(918)835-7109"
  55.  
  56.  
  57. ******************************************************************************/
  58.