class Text
Text helper
As for all helpers, all methods are statics.
For convenience, the best practice is to use:
use Library\Helper\Text as TextHelper;
Methods
static string |
cut(string $string = '', int $length = 120, string $end_str = ' ...')
Truncate a string at a maximum length, adding it a suffix like '...' |
|
static string |
wrap($str $str = '', int $line_length = 75, string $separator = PHP_EOL)
|
|
static string |
stripSpecialChars(string $string = '', string $authorized = '')
Strip all special characters in a string |
|
static string |
slugify(string $string = '')
Get a slugified string |
|
static string |
getHumanReadable(string $string = '')
Transform a string to a human readable one |
|
static string |
toCamelCase(string $name = '', string $replace = '_', bool $capitalize_first_char = true)
Transform a name in CamelCase |
|
static string |
fromCamelCase(string $name = '', string $replace = '_', bool $lowerize_first_char = true)
Transform a name from CamelCase to other |
Details
at line 48
static public string
cut(string $string = '', int $length = 120, string $end_str = ' ...')
Truncate a string at a maximum length, adding it a suffix like '...'
at line 74
static public string
wrap($str $str = '', int $line_length = 75, string $separator = PHP_EOL)
at line 99
static public string
stripSpecialChars(string $string = '', string $authorized = '')
Strip all special characters in a string
This will replace all accentuated letters by their non-accentuated equivalent and delete all other special characters (including space by default).
at line 126
static public string
slugify(string $string = '')
Get a slugified string
By Miguel Santirso (http://sourcecookbook.com/en/recipes/8/function-to-slugify-strings-in-php)
at line 142
static public string
getHumanReadable(string $string = '')
Transform a string to a human readable one
at line 155
static public string
toCamelCase(string $name = '', string $replace = '_', bool $capitalize_first_char = true)
Transform a name in CamelCase
at line 175
static public string
fromCamelCase(string $name = '', string $replace = '_', bool $lowerize_first_char = true)
Transform a name from CamelCase to other