Prev Page Next Page

String

Formal Definition

The string type is predefined in the package Standard as a standard one-dimensional array type with each element being of the type Character.

Syntax:

type String is array (positive range <>) of character;

Description

The type string is an unconstrained vector of elements of the type Character. The size of a particular vector must be specified during its declaration (see example). The way the vector elements are indexed depends on the defined range - either ascending or descending (see range).

Assignment to an object of the type string can be performed in the same way as in case of any arrays, i.e. using single element assignments, concatenation, aggregates, slices or any combination of them.

The package Standard contains declarations of the predefined operators for the type String: "=", "/=", "<", "<=", ">", ">=" and "&". Relational operators allow to compare two strings, while the concatenation operator allows to concatenate two strings, a string and a character and two characters to create a string.

Examples

Example 1

constant Message1 : String(1 to 19) := "hold time violation";
signal Letter1 : character;
signal Message2 : string(1 to 10);
. . .
Message2 <= "Not" & Letter1;

 

Important Notes

 
Prev Page Next Page