Converts any genie variable into a string.
AS_STRING | var=Generic | Print a variable into an internal string |
example:
# Format a real to two decimal places >> printn myval 34.234567 >> str = as_string(myval) >> prec = Substring( str, _, locate(str,".") + 2 ) >> printn prec 34.23 # useful for graphics >> Draw/text xcoord=0.5 ycoord=0.5 prec
Note: Has a similar purpose to the FORTRAN internal write.
This function is used in much the same way as the FORTRAN internal write statement. It allows a GCL program to get access to the string which would normally be printed out to a terminal with a Print() command. A likely use of this command is formatting text which is going to be displayed on the graphics screen (which the Print() commands do not write to). Being a generic function, the As_string() command will work with any sort of Open GENIE variable.
Var (Generic)
Any Open GENIE variable or expression can be put here.
RESULT = (String)
A string exactly as if the variable had been printed to the console window with the Print() command.