v50 Steam/Premium information for editors
  • v50 information can now be added to pages in the main namespace. v0.47 information can still be found in the DF2014 namespace. See here for more details on the new versioning policy.
  • Use this page to report any issues related to the migration.
This notice may be cached—the current version can be found here.

Difference between revisions of "Help:Parser functions"

From Dwarf Fortress Wiki
Jump to navigation Jump to search
m
(document a couple functions)
Line 1: Line 1:
==Custom parser functions==
+
= Custom parser functions =
 +
== String functions ==
 
=== strc ===
 
=== strc ===
  
Example: <pre></pre>
+
Expands backslash escape sequences, such as:
&rarr;
+
 
 +
{|class="wikitable"
 +
! Text !! Produces
 +
|-
 +
| \n || newline
 +
|-
 +
| \t || tab
 +
|}
 +
 
 +
Example: <pre>Some example{{#strc:\t}}text</pre>
 +
Produces:
 +
{{#tag:pre|Some example{{#strc:\t}}text}}
  
 
=== strcount ===
 
=== strcount ===
  
Example: <pre></pre>
+
Returns the number of occurrences of the second parameter in the first parameter. Case-sensitive
&rarr;  
+
 
 +
Example: <pre>{{#strcount:This string sure has a lot of "T"'s in it! | t}}</pre>
 +
&rarr; {{#strcount:This string sure has a lot of "T"'s in it! | t}}
  
 
=== stricount ===
 
=== stricount ===
  
Example: <pre></pre>
+
Same as strcount, but case-insensitive.
&rarr;  
+
 
 +
Example: <pre>{{#stricount:This string sure has a lot of "T"'s in it! | t}}</pre>
 +
&rarr; {{#stricount:This string sure has a lot of "T"'s in it! | t}}
  
 
=== stripos ===
 
=== stripos ===

Revision as of 01:47, 20 February 2014

Custom parser functions

String functions

strc

Expands backslash escape sequences, such as:

Text Produces
\n newline
\t tab

Example:

Some example{{#strc:\t}}text

Produces:

Some example	text

strcount

Returns the number of occurrences of the second parameter in the first parameter. Case-sensitive

Example:

{{#strcount:This string sure has a lot of "T"'s in it! | t}}

→ 3

stricount

Same as strcount, but case-insensitive.

Example:

{{#stricount:This string sure has a lot of "T"'s in it! | t}}

→ 5

stripos

Example:


stristr

Example:


strlen

Example:


strpos

Example:


strripos

Example:


strrpos

Example:


strsplit

Example:


strstr

Example:


sha1

Example:


md5

Example:


randint

Example:


param

Example: