3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
6 | This work is published under the GNU AGPLv3 license with some |
7 | permitted exceptions and without any warranty. For full license |
8 | and copyright information, see https://civicrm.org/licensing |
9 +--------------------------------------------------------------------+
15 * @copyright CiviCRM LLC https://civicrm.org/licensing
24 * Author: Thorsten Albrecht <thor_REMOVE.THIS_@wolke7.net>
25 * Purpose: "substring" allows you to retrieve a small part (substring) of a string.
26 * Notes: The substring is specified by giving the start position and the length.
27 * Unlike the original function substr() in PHP the position of the characters
28 * in the string starts at 1 (not at 0 as usual in php).
29 * Example smarty code:
30 * {$my_string|substring:2:4}
31 * returns substring from character 2 until character 6
32 * @link based on substr(): http://www.zend.com/manual/function.substr.php
33 * @param string $string
34 * @param int $position
35 * startposition of the substring, beginning with 0
40 function smarty_modifier_substring($string, $position, $length) {
41 return substr($string, $position, $length);