Es formatv
From EventScripts Community Encyclopedia
|
[edit] OverviewSyntax: Note: Command parameters are described inside the
< and > characters. Optional parameters are contained within [ and ] characters.Variation of this command that doesn't expand variables: es_xformatv [edit] DescriptionFormats a string according to the format-string and stores it into the variable. [edit] Parameters
[edit] ExamplesThis example demonstrates the usage of es_formatv and shows the difference between es_format and es_formatv: es_xsetinfo myvar 0 es_xsetinfo param1 "is" es_xsetinfo param2 "string" es_xsetinfo param3 "results from placing" es_xsetinfo param4 "the format-string." // Using es_format: es_format myvar "This %1 the %2 that %3 the tokens into %4" server_var(param1) server_var(param2) server_var(param3) server_var(param4) es_msg server_var(myvar) // Using es_formatv: es_xformatv myvar "This %1 the %2 that %3 the tokens into %4" param1 param2 param3 param4 es_msg server_var(myvar) //will display in both cases: This is the string that results from placing the tokens into the format-string.
[edit] Notes
es_set temp event_var(userid) es_xformatv result "Userid is %1" temp
es_xsetinfo var1 "ro" es_xsetinfo var2 "fl" es_xsetinfo format 0 es_xformatv format "%1%2" var1 var2 es_msg server_var(format) // Will display: rofl
es_xsetinfo string "hello" es_xsetinfo word1 "world" es_xformatv string "%1 %2" string word1 es_msg server_var(string) // Will display: "Hello World"
[edit] See also |
