intValue
OPL function to convert a string to an integer
Purpose
OPL function to convert a string to an integer.
| type |
|---|
int |
Syntax
intValue(string)
Description
Converts a string to an integer value, if possible. You can use this function within IBM ILOG Script statements by specifying the OPL namespace:
( Opl.xxx() )
Example
Model
string a="-2";
string b="3";
int intValueofa=intValue(a);
int intValueofb=intValue(b);
execute
{
writeln("intValue(\"",a,"\") gives ",intValueofa);
writeln("intValue(\"",b,"\") gives ",intValueofb);
}
Result
intValue("-2") gives -2
intValue("3") gives 3