Sign in Join
Wiki copytemporary

Str

Deutsch · English · Русский

The procedure str converts an ordinal or real type value to a string representation thereof. It is a UCSD Pascal extension that was picked up and generalized by Borland Pascal. The FreePascal compiler supports it, too, as described here.

invocation

The formal signature of str cannot be written in Pascal, hence a description follows:

Str requires two parameters. The first parameter has to be an ordinal or real type expression. The second parameter specifies the destination. It has to be a variable of the type string (or an array[dimension] of char).

The first parameter may optionally be followed by a colon and an integer expression. This will determine the minimum width of the generated string representation. However, bear in mind if the destination variable is a fixed-length string, no more characters than its maximum capacity can be stored. In this case any surplus characters will be clipped.

If the first parameter is a real expression, the parameter may be followed by another colon and integer after the first colon and integer specifying the minimum width. This number, however, will determine the number of decimal places after the radix mark.

formatting

Specifying a second formatting for the real number representation will disable the usual scientific notation.

Enumerated type values will be left-justified, numeric values will be right-justified.

Str cannot produce decimal numbers containing a comma as a radix mark.

Str only produces numbers to the base of ten. FPC’s standard run-time library provides the functions binStr, octStr, and hexStr, which produce string representations of integers according to base of two, eight and sixteen respectively. Real values cannot be easily represented in other bases.

see also


From the Free Pascal wiki, page "Str", as it stood on 2023-03-05 after a change by Kai Burghardt, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's Licensing page. If you have concerns about this material, message the admin.

Revision 1, last changed by WikiArchive .

Talk about this page

Nobody has opened a bench for this page yet. Sign in to open one.