mirror of
https://github.com/myvesta/vesta
synced 2025-07-06 04:51:54 -07:00
php myvesta_str_substring
This commit is contained in:
parent
4dd6d22f07
commit
452f8a81d9
1 changed files with 16 additions and 0 deletions
|
@ -248,3 +248,19 @@ function myvesta_str_lowercase() {
|
||||||
}
|
}
|
||||||
return strtolower($text);
|
return strtolower($text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function myvesta_str_substring() {
|
||||||
|
global $myvesta_stdin;
|
||||||
|
$args=func_get_args();
|
||||||
|
$args_i=-1;
|
||||||
|
if ($myvesta_stdin!='') {
|
||||||
|
$text=$myvesta_stdin;
|
||||||
|
} else {
|
||||||
|
$args_i++; $text=$args[$args_i];
|
||||||
|
}
|
||||||
|
$args_i++; $start=$args[$args_i];
|
||||||
|
$args_i++; $length=null; if (!empty($args[$args_i])) $length=intval($args[$args_i]);
|
||||||
|
|
||||||
|
if ($length===null) return substr($text, $start);
|
||||||
|
if ($length!==null) return substr($text, $start, $length);
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue