Next: Logical Expressions
Up: Command Format
Previous: Command Attribute Types
  Contents
  Index
String Attributes
A string attribute makes alphanumeric information available,
e.g. a title, file name, element class name, or an option.
It can contain any characters, enclosed in single (')
or double (") quotes.
However, if it contains a quote, this character must be doubled.
Strings can be concatenated using the
& operator.
An operand in a string can also use the
function STRING.
String values can occur in string arrays.
Table 2.1:
String Operator in MAD-9
Operator |
Meaning |
result type |
operand types |
X & Y |
concatenate the strings X and Y.
String concatenations are always evaluated immediately when read. |
string |
string,string |
Table 2.2:
String Function in MAD-9
Function |
Meaning |
result type |
argument type |
STRING(X) |
return string representation of the value
of the numeric expression X |
string |
real |
Examples:
TITLE,"This is a title for the program run ""test""";
CALL,FILE="save";
X=1;
TWISS,LINE=LEP&STRING(X+1);
The second example converts the value of the expression ``X+1'' to a
string and appends it to ``LEP'', giving the string ``LEP2''.
Next: Logical Expressions
Up: Command Format
Previous: Command Attribute Types
  Contents
  Index
MAD User Guide, http://wwwslap.cern.ch/mad/