string
OPL keyword for strings
Purpose
OPL keyword to declare a data string.
| context |
|---|
| Model files (.mod) |
Syntax
LiteralType: "int"
| "float"
| "boolean"
| "int+"
| "float+"
| "string"
| "range"
| "range" "float"
| "constraint"
Description
The string instruction is used to declare a data string.
Strings can appear in tuples and index arrays. Sets of strings can
be computed at run time but the OPL implementation must check string
indices at run time as well.
Note:
Strings are required to use the database functionalities.
Example
string myString = “Hello”;
string ColorTable[1..3] = [“red”, “blue”, “green”];
The excerpt:
{string} Tasks = {“masonry”, “carpentry”, “plumbing”, “ceiling”,
“roofing”, “painting”, “windows”, “facade”,
“garden”, “moving”};
defines and initializes a set of strings.