Core Function ResolveStr

From Sputnik Wiki
(Difference between revisions)
Jump to: navigation, search
(Created page with "<pre> ResolveStr( <expression> ) </pre> === Description === Treat a given string as if it was a Sputnik "string" and parse all stuff inside it such as $variables etc. === Para...")
 
m (1 revision)
 
(3 intermediate revisions by one user not shown)
Line 1: Line 1:
 
<pre>
 
<pre>
ResolveStr( <expression> )
+
ResolveStr( <expression>, <allowEscapes>, <allowVariables>, <allowCode> )
 
</pre>
 
</pre>
  
Line 12: Line 12:
  
 
The string to use.
 
The string to use.
 +
 +
==== allowEscapes ====
 +
 +
True to allow parsing of escapes such as \n etc.
 +
 +
False to disallow parsing of escapes.
 +
 +
Default: false
 +
 +
==== allowVariables ====
 +
 +
True to allow parsing of variables such as $cat @cow etc.
 +
 +
False to disallow parsing of variables.
 +
 +
Default: false
 +
 +
==== allowCode ====
 +
 +
True to allow parsing of stuff inside { } and/or \C \c as physical Sputnik code.
 +
 +
False to disallow parsing of variables.
 +
 +
Default: false
  
 
=== Return Value ===
 
=== Return Value ===
Line 27: Line 51:
 
<syntaxhighlight lang="sputnik">
 
<syntaxhighlight lang="sputnik">
 
println("Without Resolve: " . 'The value is $lol'  );
 
println("Without Resolve: " . 'The value is $lol'  );
println("With Resolve: " . ResolveStr('The value is $lol')  );
+
println("With Resolve: " . ResolveStr('The value is $lol', true, true, true)  );
 
</syntaxhighlight>
 
</syntaxhighlight>
  
 
[[Category:Core Function]]
 
[[Category:Core Function]]

Latest revision as of 12:37, 14 June 2015

ResolveStr( <expression>, <allowEscapes>, <allowVariables>, <allowCode> )

Contents

Description

Treat a given string as if it was a Sputnik "string" and parse all stuff inside it such as $variables etc.

Parameters

expression

The string to use.

allowEscapes

True to allow parsing of escapes such as \n etc.

False to disallow parsing of escapes.

Default: false

allowVariables

True to allow parsing of variables such as $cat @cow etc.

False to disallow parsing of variables.

Default: false

allowCode

True to allow parsing of stuff inside { } and/or \C \c as physical Sputnik code.

False to disallow parsing of variables.

Default: false

Return Value

Success: Returns new string.

Failure: Returns empty string.

Remarks

None.

Example

println("Without Resolve: " . 'The value is $lol'   );
println("With Resolve: " . ResolveStr('The value is $lol', true, true, true)   );
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox