• <GetStart>
  • CSPro User's Guide
    • The CSPro System
    • Data Dictionary Module
    • The CSPro Language
    • Data Entry Module
    • Batch Editing Applications
    • Tabulation Applications
    • Data Sources
    • CSPro Statements and Functions
      • Statement Format Symbols
      • Alphabetical List of Functions and Statements
      • List of Reserved Words
      • Deprecated Features
      • Declaration Statements
      • Symbol Functions
      • Item Functions
      • Array Object
      • Audio Object
      • Barcode and QR Codes
      • Case Object
      • Document Object
      • File Object
      • Freq Object
      • Geometry Object
      • HashMap Object
      • Image Object
      • List Object
      • Map Object
      • Path
      • Pff Object
      • SystemApp Object
      • ValueSet Object
      • Program Control Statements
      • Assignment Statements
      • Data Entry Statements and Functions
      • Batch Edit Statements
      • Numeric Functions
      • String Functions
        • compare Function
        • compareNoCase Function
        • Concat Function
        • String Concatenation Operator
        • Edit Function
        • GetBuffer Function
        • Length Function
        • maketext Function
        • Message Formatting Options
        • Pos Function
        • PosChar Function
        • RegExMatch Function
        • Replace Function
        • StartsWith Function
        • Strip Function
        • ToLower Function
        • ToNumber Function
        • ToUpper Function
      • Multiple Occurrence Functions
      • General Functions
      • Date and Time Functions
      • External File Functions
      • Synchronization Functions
    • Templated Reporting System
    • HTML and JavaScript Integration
    • Action Invoker
    • Appendix
  • <CSEntry>
  • <CSBatch>
  • <CSTab>
  • <DataViewer>
  • <TextView>
  • <TblView>
  • <CSFreq>
  • <CSDeploy>
  • <CSPack>
  • <CSDiff>
  • <CSConcat>
  • <Excel2CSPro>
  • <CSExport>
  • <CSIndex>
  • <CSReFmt>
  • <CSSort>
  • <ParadataConcat>
  • <ParadataViewer>
  • <CSCode>
  • <CSDocument>
  • <CSView>
  • <CSWeb>

Edit Function

Format
s = edit(edit_pattern, numeric_expression);
Description
The edit function converts a number to a character string defined by the given "edit pattern". The "edit pattern" is a string containing "Z"s and/or "9"s (i.e., "9999" or "ZZ9.99"). Both "9" and "Z" represent a digit as follows:
9display a digit
Zdisplay a digit, but if it would be a leading zero for the given width, display a blank
.display the decimal character
,display the thousands separator character
Any other character will be displayed as itself.
Return value
The function returns a string derived from the numeric_expression argument.
Example 1
X = 87;
A1 = 
edit("ZZZ9",X); // yields A1 = "  87"
A2 = edit("9999",X); // yields A2 = "0087"
A3 = edit("Z999",X); // yields A3 = " 087"
Example 2
Y = 0;
A4 = 
edit("ZZ9",Y); // yields A4 = "  0"
A5 = edit("999",Y); // yields A5 = "000"
A6 = edit("ZZZ",Y); // yields A6 = "   "
Example 3
T = edit("99:99:99", systime()); // yields T = "16:04:42" for the time 4:04pm and 42 seconds
Example 4
D = edit("99/99/99", sysdate("DDMMYY"));
Example 5
A = edit("ZZZ,ZZZ,ZZ9", INCOME);
See also: ToNumber Function, SysDate Function, maketext Function