]> gitweb.factorcode.org Git - factor.git/blob - basis/interpolate/interpolate-docs.factor
interpolate: allow mixing of named variables and stack arguments.
[factor.git] / basis / interpolate / interpolate-docs.factor
1 USING: help.markup help.syntax io math strings ;
2 IN: interpolate
3
4 HELP: interpolate.
5 { $values { "str" string } }
6 { $description "String interpolation using named variables and/or stack arguments, writing to the " { $link output-stream } "." }
7 { $examples
8     { $example
9         "USING: interpolate ;"
10         "\"Bob\" \"Alice\" \"Hi ${0}, it's ${1}.\" interpolate."
11         "Hi Bob, it's Alice."
12     }
13     { $example
14         "USING: interpolate namespaces ;"
15         "\"Fred\" \"name\" [ \"Hi ${name}\" interpolate. ] with-variable"
16         "Hi Fred"
17     }
18 } ;
19
20 HELP: interpolate
21 { $values { "str" string } { "newstr" string } }
22 { $description "String interpolation using named variables and/or stack arguments, captured as a " { $link string } "." } ;
23
24 { interpolate interpolate. } related-words