This page last changed on Oct 18, 2011 by jed.wheeler@involver.com.
Overview
This filter prepends a specified string to the variable being filtered.
Attributes
type |
required |
description |
string |
true |
The string to prepend to the filtered variable. |
Examples
Prepend some characters to a string
Given the string "bar", to come up with "foobar", you would use the following code:
{{ 'bar' | prepend: 'foo' }}
The above code would yield:
Prepend a title to a name
Given the string, "Mary had a little lamb.", if you wanted to indicate that Mary was your aunt, you would use:
{{ 'Mary had a little lamb.' | prepend: 'Aunt ' }}
The above code would yield:
Aunt Mary had a little lamb.
FAQ
- Can I use this to add characters to the end of another string?
No, you would use the append filter for that purpose (see below).
Related Topics
|