User Tools

Site Tools


en:public:developer:template_system:tags:string:stringreplace

Table of Contents

<#StringReplace>

Replaces occurrences of a substring within a string. StringReplace replaces occurrences of the substring specified by OldPattern with the substring specified by NewPattern in the string S.

Using StringReplace tag is essentially placing application logic into the presentation 
that may be better handled in PHP. Use at your own discretion. 

Parameters

Name Mandatory Default Description
Str Yes Source string
OldPattern Yes Replaces occurrences of the substring specified by OldPattern
NewPattern No With the substring specified by NewPattern
ReplaceAll No 0 Replace all occurrences. If this flag is not present, only the first occurrence of the target substring is replaced
IgnoreCase No 0 Match occurrences of the substring case-insensitively. If this flag is not present, only case-sensitive matches are considered

Example

<#stringreplace str="abcde" OldPattern="abc" NewPattern="...">

The above example will output:

...de
en/public/developer/template_system/tags/string/stringreplace.txt · Last modified: 2012/11/26 11:01 by admin