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
26 * Author: Thorsten Albrecht <thor_REMOVE.THIS_@wolke7.net>
27 * Purpose: "substring" allows you to retrieve a small part (substring) of a string.
28 * Notes: The substring is specified by giving the start position and the length.
29 * Unlike the original function substr() in PHP the position of the characters
30 * in the string starts at 1 (not at 0 as usual in php).
31 * Example smarty code:
32 * {$my_string|substring:2:4}
33 * returns substring from character 2 until character 6
34 * @link based on substr(): http://www.zend.com/manual/function.substr.php
35 * @param string $string
36 * @param int $position
37 * startposition of the substring, beginning with 0
42 function smarty_modifier_substring($string, $position, $length) {
43 return substr($string, $position, $length);