llms_trim_string( string $string, int $chars = 200, string $suffix = '...' )
Trim a string and append a suffix
Parameters Parameters
- $string
-
(string) (Required) Input string.
- $chars
-
(int) (Optional) Max number of characters. Default is 200.
Default value: 200
- $suffix
-
(string) (Optional) A suffix to append. Default is '...'.
Default value: '...'
Return Return
(string)
Source Source
File: includes/llms.functions.core.php
function llms_trim_string( $string, $chars = 200, $suffix = '...' ) { if ( strlen( $string ) > $chars ) { if ( function_exists( 'mb_substr' ) ) { $string = mb_substr( $string, 0, ( $chars - mb_strlen( $suffix ) ) ) . $suffix; } else { $string = substr( $string, 0, ( $chars - strlen( $suffix ) ) ) . $suffix; } } return $string; }
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
3.0.0 | Introduced. |