User Tools

Site Tools


en:public:developer:template_system:tags:expression:pos

This is an old revision of the document!


<#Pos>

Returns the index value of the first character in a specified substring that occurs in a given string. Pos returns the index of SubStr in S, beginning the search at Offset. Pos is case-sensitive. If SubStr is not found or Offset is invalid (greater than the length of Str or less than 1), then the result is 0.

Using POS tag is essentially placing application logic into the presentation 
that may be better handled in PHP. Use at your own discretion. 
<code>
==== Parameters ====

^ Name                                                      ^ Mandatory ^ Default ^ Description ^     
| <html><span style="color:#008000">SubStr</span></html>    | Yes       |         | The name of the variable |
| <html><span style="color:#008000">Str</span></html>       | Yes       |         | If empty return the value of the variable "Name", else initialize the value of the variable "Name" |
| <html><span style="color:#008000">Offset</span></html>    | No        | 1       | If no custom variable "Name" are defined, return the value of this parameter |

==== Example ====

<code>

<#pos substr="abcd" str="abcdefgh">

The above example will output:

1
en/public/developer/template_system/tags/expression/pos.1353575783.txt.gz · Last modified: 2012/11/22 13:16 by admin