String manipulation functions: Card

Top  Previous  Next

GAMS possesses a few string manipulation functions.  These are built on top of Ord and Card.  When called with a string the Card command returns the number if characters in the string and is addressed as follows

 

Card(string);

or

namedscalar=card(string);

 

where string may be

itemname.ts to get the length of the explanatory text associated with the named item itemname
setname.tlto get the length of the element name associated with the referenced element of the set setname
setname.teto get the length of the explanatory text associated with the referenced element of the set setname
"atextstring"to get the length of the text in a quoted text string