The
StringWriter statement creates a
StringWriter, an incremental string builder, with the name
string_writer_name. The StringWriter name must be unique and must contain only letters, numbers, or the underscore character. The name must begin with a letter. You can declare StringWriter objects globally in
PROC GLOBAL or locally in functions or procedures.
If a
report_name is specified in parentheses after the name of the object, the StringWriter object wraps a
templated report and assumes the
encoding type used by the
Report object.
You cannot specify an
encoding_type or
report_name when declaring a StringWriter as a
user-defined function parameter because the StringWriter will assume the encoding type of the object passed to the function as an argument.
function AddToStringWriter(StringWriter sw)
sw.writeLine("<** Hello, **>");
sw.writeEncodedLine("<** World! **>");
end;
// the result based on different encoding types is shown:
StringWriter sw; // <** Hello, **>
AddToStringWriter(sw); // <** World! **>
StringWriter sw_html(HTML); // <** Hello, **>
AddToStringWriter(sw_html); // <** World! **><br>
StringWriter sw_md(Markdown); // <** Hello, **>
AddToStringWriter(sw_md); // <\*\* World\! \*\*><br>