input|replace( offset [, length [, sequence1 [, sequence2 [, ...]]] ] )
Name | Type | Description | Required |
---|---|---|---|
offset | integer | The offset to start replacing elements. | Yes |
length | integer | The number of characters that should be replaced. | No |
sequence1 | any | The sequence that will replace characters in input string. | No |
sequence2 | any | The sequence that will replace characters in input string. | No |
This operator replaces character(s) from the input string and a replaced version of input string will be returned. The "offset" parameter must be used to define the start of the portion that should be replaced. The "length" parameter can be used to define the number of characters that should be replaced. If length is omitted, the sequence(s) will be placed after the offset(like 'insert' operator).
Example 1
{'12345'|replace( 1, 2 )}
The following string will be returned: '145'.
Example 2
{'12345'|replace( 1 )}
The following array will be returned: '12345' .
Example 3
{'12345'|replace( 1, 2, 'ab' )}
The following array will be returned: '1ab45' .
Example 4
{{'12345'|replace( 1, 2, 'a', 'b', 'c' )}
The following array will be returned: '1abc45' .
Example 5
{'12345'|replace( 1, , 'abc' )}
The following array will be returned: '1abc2345' .
Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2013 eZ Systems AS (except where otherwise noted). All rights reserved.