Contents - Index


String Variables

 

EES supports numerical and string variables.  A string variable is identified with a variable name that ends with the $ character.  A string array variable has the $ character just before the left bracket that holds the array index.  The variable name must begin with a letter and consist of 30 or fewer characters, including the $ characters.

 

String variables can be set to string constants which are enclosed with single quote marks, e.g.

 

A$='carbon dioxide'

 

String variables can be set equal to other string variables, e.g.,

 

B$=C$

 

String functions are provided to manipulate string variable and to convert them to or from numerical values.

 

String variables may be passed as arguments to internal  functions, Procedures Modules, or external functions and Procedures.  

 

In general string variables can be used in EES equations anywhere in which character information is provided.  For example, the name of a fluid provided to a thermophysical property function may be a string variable, e.g.,

 

h=enthalpy(R$,T=T,P=P)

 

A string variable may be used to supply the name of a Lookup file or the name of a column for use with the Interpolate or Lookup commands, e.g.,

 

m=Interpolate(File$,Col1$,Col2$,Col1$=x)

k=Lookup(File$,Row,Col$) 

 

A string variable may be used to supply the units of other variables.  For example,

 

U$='kJ/kg'

h=15 [U$]

 

The comment to the right of the 15 sets the units of variable h to U$.  The units could also be set in the Variable Info dialog or by clicking on h in the Solution window.  In any case, EES will recognize that U$ is a string variable and set the units of h to the string that is assigned to U$.

 

String variables may be supplied to the Equations Window using the Diagram Window, either with an edit box or with a pull-down list of alternatives.  See the Diagram Window for more information.