Using string value presentations

1C:Enterprise supports string presentations of most values. A string presentation is an explicit or implicit conversion to a String value. You can perform explicit conversion using the String() function. The conversion is also performed in string expressions, such as:

"Test:" + CurrentDate()

The platform also converts values to strings before displaying them in the user interface. For example, it converts values displayed in the message window (by the Message() function), tabular section values, spreadsheet document values, and so on.

Note that the sole purpose of string conversion is getting a human-readable value presentation, which is then displayed to the end user. Each value type supports a conversion method defined in the system. The conversion takes into account infobase, user, and session parameters.

For example, conversion of numbers, dates, and Boolean values to strings takes into account regional infobase settings.

When a reference to a document is converted to string, the following data is used: document synonym in the end user's language and the platform interface language.

Some values, such as Undefined and Null, have empty string presentations ("").

Sometimes the value itself affects generation of string presentations. For example, a string presentation of a value list contains a limited number of values, and each value has limited length.

The basic string presentation usage rule is as follows: use string presentations for displaying values in the user interface and do not use them in business logic algorithms. That is, do not parse string presentations and do not generate any values based on string presentations in your algorithms. Use string presentations only for displaying values on screen or writing them to files for later viewing and printing.

Do not use string presentations for serialization (saving values in string format). Use other serialization tools, such as writing values in XML format. For more information, see Serialization usage specifics.

Do not use string presentations for analyzing values (except for analyzing and comparing string presentations). For example, check values of Data type by comparing them with values of Data type. To check a value type, get the type and compare it with a value of Type type obtained from the type name; do not use string presentations of the type or value for this purpose. For more information, see Analyzing value types.

There are exceptions from this rule. A string presentation of a String object exactly matches its content. The string presentation of a UUID obejct is used for generating a value of this type from a string.

Remember that getting string presentations of references to database objects takes some time. Performing many conversions might hinder the system performance. The same is true for getting string presentations of values that contain references to database objects (for example, value lists).

Also remember that string presentation of numbers, dates, and Boolean values depend on infobase regional settings. For example, Russian number presentation includes nonbreaking spaces as separators between character triplets. To get a string presentation in custom format, use the Format() function. For more information, see Formatting values.

Add comment