FORMAT_INTEGER

Help Contents

Introduction

Converts an integer to a string using a defined number base.

Syntax

Informal Syntax:

FORMAT_INTEGER( Value, Base )

Formal Syntax:

FORMAT_INTEGER( Value:=expression, Base:=expression )

Parameters

ParameterTypeDescription
Value ANY_INT The input value to convert to a string.
Base ANY_INT The number base to use in the conversion. Use any value in the range 2 to 16. Values less than 2 are rounded up to 2. Values more than 16 are rounded down to 16.

Return Value

The function FORMAT_INTEGER returns the Value parameter converted to a STRING. The conversion uses a number base defined by the Base parameter.

Examples

ExampleReturn Value
FORMAT_INTEGER( 1000, 2 )STRING#'1111101000'
FORMAT_INTEGER( 1000, 5 )STRING#'13000'
FORMAT_INTEGER( 1000, 8 )STRING#'1750'
FORMAT_INTEGER( 1000, 10 )STRING#'1000'
FORMAT_INTEGER( 1000, 16 )STRING#'3E8'

Standards Compliance

The function FORMAT_INTEGER is an extension to the IEC 61131-3 standard.

Further Information

Conversion Functions

To learn about other Conversion Functions.

String Literals

To learn about string literals and the different types of encoding used.

Common Elements

To learn about other IEC 61131-3 Common Elements.

Glossary

For the meaning of terms used in Fernhill SCADA.