1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
stringhelper.php
См. документацию.
1
<?php
8
9
namespace
Bitrix\Main\Text;
10
16
class
StringHelper
17
{
25
public
static
function
strtoupper
(
$str
)
26
{
27
static
$cache;
28
29
if
(empty($cache[
$str
]))
30
{
31
$cache[
$str
] = mb_strtoupper(
$str
);
32
}
33
34
return
$cache[
$str
];
35
}
36
44
public
static
function
camel2snake
(
$str
)
45
{
46
return
mb_strtolower(preg_replace(
'/(.)([A-Z])/'
,
'$1_$2'
,
$str
));
47
}
48
56
public
static
function
snake2camel
(
$str
,
bool
$lowCaseFirst =
false
)
57
{
58
$str
=
str_replace
(
'_'
,
' '
, mb_strtolower(
$str
));
59
$str
=
str_replace
(
' '
,
''
, ucwords(
$str
));
60
61
return
$lowCaseFirst
62
? lcfirst(
$str
)
63
:
$str
;
64
}
65
74
public
static
function
str_replace
($search, $replace,
$str
)
75
{
76
if
(is_array(
$str
))
77
{
78
foreach
(
$str
as
$key
=> $value)
79
{
80
if
(is_scalar($value))
81
{
82
$str
[
$key
] =
str_replace
($search, $replace, $value);
83
}
84
}
85
}
86
elseif
(is_scalar(
$str
))
87
{
88
$str
=
str_replace
($search, $replace,
$str
);
89
}
90
91
return
$str
;
92
}
93
100
public
static
function
isStringable
($value): bool
101
{
102
return
!is_array($value)
103
&& (
104
(!is_object($value) && settype($value,
'string'
) !==
false
)
105
|| (is_object($value) && method_exists($value,
'__toString'
))
106
);
107
}
108
}
Bitrix\Main\Text\StringHelper
Определения
stringhelper.php:17
Bitrix\Main\Text\StringHelper\isStringable
static isStringable($value)
Определения
stringhelper.php:100
Bitrix\Main\Text\StringHelper\strtoupper
static strtoupper($str)
Определения
stringhelper.php:25
Bitrix\Main\Text\StringHelper\snake2camel
static snake2camel($str, bool $lowCaseFirst=false)
Определения
stringhelper.php:56
Bitrix\Main\Text\StringHelper\camel2snake
static camel2snake($str)
Определения
stringhelper.php:44
Bitrix\Main\Text\StringHelper\str_replace
static str_replace($search, $replace, $str)
Определения
stringhelper.php:74
$str
$str
Определения
commerceml2.php:63
elseif
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
Определения
prolog_main_admin.php:393
$key
if(empty($signedUserToken)) $key
Определения
quickway.php:257
bitrix
modules
main
lib
text
stringhelper.php
Создано системой
1.14.0