StringWriter (FB)ΒΆ

FUNCTION_BLOCK StringWriter

The StringWriter is ideal for creating large strings. You can concatenate STRINGs with the method AppendString and WSTRINGs with the method AppendWString.

The data is copied to an internal memory. Strings with a maximum length of UDINT can be passed.

The normal workflow is as follows:

  • You start with a fresh StringWriter or you initialize the existing one with the method StringWriter.Clear.

  • Subsequently, the concatenation methods StringWriter.AppendString or StringWriter.AppendWString are used.

    Attention

    Mixed operation is not permitted!
    Only a concatenation of the same string type is possible.
    The data is transferred to the internal memory without filtering or any kind of type conversion.
  • Finally, copy the result to the desired location using the method StringWriter.CopyString.

Note

If there is a need to concatenate larger constant character strings again and again, it is possible to reduce the memory requirement and increase performance by providing these character strings with an SBM.Buffer and passing them to the method StringWriter.AppendBuffer.

Methods:

Structure: