2015-04-18 20:18:37 -04:00
|
|
|
USING: help.markup help.syntax io math strings ;
|
2013-07-24 11:44:31 -04:00
|
|
|
IN: interpolate
|
|
|
|
|
2015-04-18 23:22:29 -04:00
|
|
|
HELP: interpolate
|
2015-04-18 20:18:37 -04:00
|
|
|
{ $values { "str" string } }
|
|
|
|
{ $description "String interpolation using named variables and/or stack arguments, writing to the " { $link output-stream } "." }
|
2015-04-20 17:44:49 -04:00
|
|
|
{ $notes "Stack arguments are numbered from the top of the stack, or provided anonymously by order of arguments." }
|
2013-07-24 11:44:31 -04:00
|
|
|
{ $examples
|
2015-04-18 20:18:37 -04:00
|
|
|
{ $example
|
|
|
|
"USING: interpolate ;"
|
2015-04-20 16:02:09 -04:00
|
|
|
"\"Bob\" \"Alice\" \"Hi ${1}, it's ${0}.\" interpolate"
|
2015-04-18 20:18:37 -04:00
|
|
|
"Hi Bob, it's Alice."
|
|
|
|
}
|
|
|
|
{ $example
|
|
|
|
"USING: interpolate namespaces ;"
|
2015-04-18 23:22:29 -04:00
|
|
|
"\"Fred\" \"name\" [ \"Hi ${name}\" interpolate ] with-variable"
|
2015-04-18 20:18:37 -04:00
|
|
|
"Hi Fred"
|
|
|
|
}
|
2015-04-20 17:44:49 -04:00
|
|
|
{ $example
|
|
|
|
"USING: interpolate ;"
|
|
|
|
"\"Mr.\" \"Anderson\"" "\"Hello, ${} ${}\" interpolate"
|
|
|
|
"Hello, Mr. Anderson"
|
|
|
|
}
|
2015-04-18 20:18:37 -04:00
|
|
|
} ;
|
|
|
|
|
2015-04-18 23:22:29 -04:00
|
|
|
HELP: interpolate>string
|
2015-04-18 20:18:37 -04:00
|
|
|
{ $values { "str" string } { "newstr" string } }
|
2015-04-20 16:02:09 -04:00
|
|
|
{ $description "String interpolation using named variables and/or stack arguments, captured as a " { $link string } "." }
|
2015-04-20 17:44:49 -04:00
|
|
|
{ $notes "Stack arguments are numbered from the top of the stack, or provided anonymously by order of arguments." } ;
|
2015-04-18 20:18:37 -04:00
|
|
|
|
2015-04-18 23:22:29 -04:00
|
|
|
{ interpolate interpolate>string } related-words
|