#### TO

#### Synopsis

    HELP:   Convert from a neutral FL5 element to a string data type
    TYPE:   OBJECT
    SYNTAX: TO(REGEXP(),CHRSET(),NUMBER(),MODE=STOP/CUT,FIXEDLENGTH=num,PADDING=NONE/RIGHT/LEFT,PADCHAR='bin'/BINARY-ZERO/ASCII-BLANK/EBCDIC-BLANK/UTF08-BLANK/UTF16BE-BLANK/UTF16LE-BLANK/UTF32BE-BLANK/UTF32LE-BLANK,NULLTERM)

#### Description

This object can be used to convert an FL5-internal string data type into one of several supported string representations (ASCII, EBCDIC, Unicode strings and numbers).

The string can be validated or manipulated using regular expressions.

The NUMBER object can be used for string-based sanitizing/cleanup of numbers and only works with the local character set. If only NUMBER is specified, then a CHRSET definition with CCSID=DEFAULT (local charset) and WHITESPACE=NUMBER is activated. The returned string containing the number is always in the local ASCII or EBCDIC representation.

If you need character set independent conversion of number strings, including conversion to various number formats (e.g. BCD, binary, ...), you should use the INTEGER or FLOAT number converters which can also read and write strings.

The string can be specified as a fixed-length string by setting the length parameter. The string is then padded with whitespace on the right side by default. The padding sequence can by set as (hex) string. If no length parameter is provided and padding is activated, the strings are padded to fill all of the provided space in memory.

Additionally, you can activate null termination for the string. The returned output length does not include the null termination character.

#### Arguments

- `NUMBER: MODE=STOP/CUT - Mode if the string does not fit into the provided space [STOP]`
  - `STOP - Stop if string longer then provided space`
  - `CUT - Cut the string to fit in the provided space`
- `NUMBER: FIXEDLENGTH=num - Pad string to this fixed length in bytes using PADCHAR [variable]`
- `NUMBER: PADDING=NONE/RIGHT/LEFT - Choose padding for variable or fixed-length strings [NONE if variable or RIGHT if fixed-length]`
  - `NONE - No padding`
  - `RIGHT - Pad on the right`
  - `LEFT - Pad on the left`
- `STRING: PADCHAR='bin'/BINARY-ZERO/ASCII-BLANK/EBCDIC-BLANK/UTF08-BLANK/UTF16BE-BLANK/UTF16LE-BLANK/UTF32BE-BLANK/UTF32LE-BLANK - Byte array to pad string to a fixed or provided length [system]`
  - `BINARY-ZERO - Padding with 0x00`
  - `ASCII-BLANK - Padding with 0x20`
  - `EBCDIC-BLANK - Padding with 0x40`
  - `UTF08-BLANK - Padding with 0x20`
  - `UTF16BE-BLANK - Padding with 0x0020`
  - `UTF16LE-BLANK - Padding with 0x2000`
  - `UTF32BE-BLANK - Padding with 0x00000020`
  - `UTF32LE-BLANK - Padding with 0x20000000`
- `SWITCH: NULLTERM - Ensure null termination of string [FALSE]`