Board Thread:Support Requests - Getting Technical/@comment-5068292-20141118151803/@comment-452-20141118165343

String functions.

Template version: {{#ifeq:{{#rpos:|.}}|-1|{{{1|{{PAGENAME}}}}}|{{#sub:{{{1|{{PAGENAME}}}}|0|{{#rpos:{{{1|{{PAGENAME}}}}}|.}}}}}}
 * If there is no dot, it returns the parameter.
 * If a parameter isn't specified, it tries to use the pagename.

Example:
 * Result:

Example:


 * Result:

{{#ifeq:  {{#rpos:{{{1|{{PAGENAME}}}}}|.}}  |-1|{{{1|{{PAGENAME}}}}}|{{#sub:{{{1|{{PAGENAME}}}}|0|  {{#rpos:{{{1|{{PAGENAME}}}}}|.}}  }}}}
 * Explanation
 * rpos finds the last . in {{{1|{{PAGENAME}}}}}

 {{#ifeq:{{#rpos:{{{1|{{PAGENAME}}}}}|.}}|-1  |{{{1|{{PAGENAME}}}}}|{{#sub:{{{1|{{PAGENAME}}}}|0|{{#rpos:{{{1|{{PAGENAME}}}}}|.}}}}}}
 * check if the dot is not found

{{#ifeq:{{#rpos:{{{1|{{PAGENAME}}}}}|.}}|-1|  {{{1|{{PAGENAME}}}}}  |{{#sub:{{{1|{{PAGENAME}}}}|0|{{#rpos:{{{1|{{PAGENAME}}}}}|.}}}}}}
 * no dot, return the input

{{#ifeq:{{#rpos:{{{1|{{PAGENAME}}}}}|.}}|-1|{{{1|{{PAGENAME}}}}}  |{{#sub:{{{1|{{PAGENAME}}}}|0|{{#rpos:{{{1|{{PAGENAME}}}}}|.}}}}}} 
 * dot is found, get the substring of the input, from position 0 to position of the dot.