• <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.toString Function

Format
s = object_name.toString()
Description
The StringWriter.toString function returns the current contents of a StringWriter object's string buffer.
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 string containing the current contents of the string buffer, or a blank string 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