manual   quickstart   instguide   update   basis

Next: 8.4 System variables Up: 8 VARIABLES Previous: 8.2 Indexed variables   Contents   Index   PDF

8.3 String variables

As explained already in section 8.1, string variables can be set as other variables in the form

variable = 'string'
variable = string_variable

Strings must be enclosed by quotes. Otherwise the string is assumed to be a variable, and if this is undefined it is assumed to be zero.

Alternatively, if the name of the variable is preceded by a dollar ($), all values are assumed to be a string. This can be a string variable, a quoted string, or an unquoted string. Note that unquoted strings are converted to upper case. Also note that quotes are compulsory if the string contains blanks.


$str=[a,b+4,'This is an example for strings']


STR(1)         =    A
STR(2)         =    B+4
STR(3)         =    This is an example for strings

As a general rule, string variables are replaced by their value only if they are preceded by a dollar ($) (exceptions: in variable definitions, on SHOW cards, and in logical expressions on IF cards, the dollar is optional). This is a precaution to avoid commands which have the same name as a variable being interpreted as variables. Variables may also appear on TEXT or TITLE cards or in strings, but must be preceded by $ in these cases. Example:

TEXT,$method results for R=$R Bohr

MCSCF results for R=1.5 Bohr

String variables can be concatenated with strings or other string variables in the following way. Assume that variable PROGRAM has the value MRCI. Setting


sets METHOD to MRCI+Q. Alternatively, if we would also have a variable VERSION with value Q, we could write


Again, the value of METHOD would be MRCI+Q. Note that the quotes are necessary in these cases.

Substring operations are not implemented.

Next: 8.4 System variables Up: 8 VARIABLES Previous: 8.2 Indexed variables   Contents   Index   PDF

manual   quickstart   instguide   update   basis 2017-12-11