|Pliant talk forum
Discussion: On the 'string' meta function
|Message posted by marcus on 2002/06/12 19:03:54
|In the Pliant documentation, the prototype of the 'string' function is
function string data [options] -> str
arg Universal data ; arg Str options str
Could you please precise what are the possible options?
|Message posted by pom on 2002/06/12 19:31:36
|options are not well documented nor precised.
"db" : the string is intended to be used for database storage
"raw" : the string should appear as for "console"
console (string "hello" "raw") eol # writes hello
console string:"hello" eol # or (string "hello" "") writes "hello"
"radix xx" : used for integers for the radix to use.
console (string 26 "radix 16") eol # writes 1A
|Message posted by maybe Hubert Tonneau on 2002/06/12 19:41:23
|Generally, an 'options' parameter is used to pass potencially and overall
dictionary (environment to the function).
Assuming that the evironment you want to pass is:
x = 5
foo = "abc"
y = 3.2
You would pass it as the "x 5 foo [dq]abc[dq] y 3.2" string
or "foo [dq]abc[dq] y 3.2 x 5"
or anything like that.
Then the target function will use the 'option' method to parse the string:
"x 5 foo [dq]abc[dq] y 3.2" option "x" Int
So, when converting to string, the options parameter enables to specify extra
details about the text encoding we want for the value, and meaningfull
options depend on the type of the data beeing converted.