Magento 2 Documentation
2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
|
Public Member Functions | |
upperCaseWords ($str, $sourceSeparator='_', $destinationSeparator='_') | |
splitInjection ($str, $length=50, $needle='-', $insert=' ') | |
split ($value, $length=1, $keepWords=false, $trim=false, $wordSeparatorRegex='\s') | |
strlen ($string) | |
cleanString ($string) | |
substr ($string, $offset, $length=null) | |
strrev ($str) | |
strpos ($haystack, $needle, $offset=null) | |
Data Fields | |
const | ICONV_CHARSET = 'UTF-8' |
Magento methods to work with string
@api
Definition at line 14 of file StringUtils.php.
cleanString | ( | $string | ) |
Clean non UTF-8 characters
string | $string |
Definition at line 161 of file StringUtils.php.
Binary-safe variant of strSplit()
string | $value | |
int | $length | |
bool | $keepWords | |
bool | $trim | |
string | $wordSeparatorRegex |
Definition at line 75 of file StringUtils.php.
splitInjection | ( | $str, | |
$length = 50 , |
|||
$needle = '-' , |
|||
$insert = ' ' |
|||
) |
Split string and appending $insert string after $needle
string | $str | |
integer | $length | |
string | $needle | |
string | $insert |
Definition at line 43 of file StringUtils.php.
strlen | ( | $string | ) |
Retrieve string length using default charset
string | $string |
Definition at line 150 of file StringUtils.php.
strpos | ( | $haystack, | |
$needle, | |||
$offset = null |
|||
) |
Find position of first occurrence of a string
string | $haystack | |
string | $needle | |
int | $offset |
Definition at line 210 of file StringUtils.php.
strrev | ( | $str | ) |
Binary-safe strrev()
string | $str |
Definition at line 189 of file StringUtils.php.
substr | ( | $string, | |
$offset, | |||
$length = null |
|||
) |
Pass through to mb_substr()
string | $string | |
int | $offset | |
int | $length |
Definition at line 174 of file StringUtils.php.
upperCaseWords | ( | $str, | |
$sourceSeparator = '_' , |
|||
$destinationSeparator = '_' |
|||
) |
Capitalize first letters and convert separators if needed
string | $str | |
string | $sourceSeparator | |
string | $destinationSeparator |
Definition at line 29 of file StringUtils.php.
const ICONV_CHARSET = 'UTF-8' |
Default charset
Definition at line 19 of file StringUtils.php.