• <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
      • Numeric Values
      • String Values
      • 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
      • StringWriter Object
        • StringWriter Statement
        • StringWriter.clear Function
        • StringWriter.toString Function
        • StringWriter.write Function
        • StringWriter.writeEncoded Function
        • StringWriter.writeEncodedLine Function
        • StringWriter.writeLine Function
        • JSON Representation
      • SystemApp Object
      • ValueSet Object
      • Program Control Statements
      • Assignment Statements
      • Data Entry Statements and Functions
      • Batch Edit Statements
      • Numeric Functions
      • String Functions
      • Multiple Occurrence Functions
      • General Functions
      • Date and Time Functions
      • External File Functions
      • Synchronization Functions
    • Text Templates
    • Templated Reporting System
    • HTML, Markdown, and JavaScript Integration
    • Action Invoker
    • Appendix
  • <CSEntry>
  • <CSBatch>
  • <CSTab>
  • <DataManager>
  • <TextView>
  • <TblView>
  • <CSFreq>
  • <CSDeploy>
  • <CSPack>
  • <CSDiff>
  • <CSConcat>
  • <Excel2CSPro>
  • <CSExport>
  • <CSIndex>
  • <CSReFmt>
  • <CSSort>
  • <ParadataConcat>
  • <ParadataViewer>
  • <CSCode>
  • <CSDocument>
  • <CSView>
  • <CSWeb>

StringWriter.clear Function

Format
b = object_name.clear()
Description
The StringWriter.clear function clears the contents of a StringWriter object's string buffer, resetting the buffer to a blank string.
Although this function can be called on a templated report or on QSF while generating question text, be aware that any text already written to the templated report or question text will be cleared. This is rarely an intended or desirable outcome.
When called on a StringWriter object based on a templated report, an error occurs if the templated report is not in the process of creation.
Return Value
The function returns a logical value of 1 (true) if successful and 0 (false) on error.
Example
StringWriter sw;

sw.
write("A");  errmsg("%s", sw.toString()); // A
sw.write("B");  errmsg("%s", sw.toString()); // AB
sw.clear();     errmsg("%s", sw.toString()); //
sw.write("C");  errmsg("%s", sw.toString()); // C
See also: StringWriter Object, Templated Reports