Bitrix-D7
20.5.0
main/lib/text/stringhelper.php
См. документацию.
1
<?php
2
/**
3
* Bitrix Framework
4
* @package bitrix
5
* @subpackage main
6
* @copyright 2001-2018 Bitrix
7
*/
8
9
namespace
Bitrix\Main\Text
;
10
11
/**
12
* String functions
13
* @package bitrix
14
* @subpackage main
15
*/
16
class
StringHelper
17
{
18
/**
19
* Regular uppercase with result cache
20
*
21
* @param $str
22
*
23
* @return mixed
24
*/
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
37
/**
38
* Changes registry from CamelCase to snake_case
39
*
40
* @param $str
41
*
42
* @return string
43
*/
44
public
static
function
camel2snake
($str)
45
{
46
return
mb_strtolower(preg_replace(
'/(.)([A-Z])/'
,
'$1_$2'
, $str));
47
}
48
49
/**
50
* Changes registry from snake_case or SNAKE_CASE to CamelCase
51
*
52
* @param $str
53
*
54
* @return mixed
55
*/
56
public
static
function
snake2camel
($str)
57
{
58
$str = str_replace(
'_'
,
' '
, mb_strtolower($str));
59
return
str_replace(
' '
,
''
, ucwords($str));
60
}
61
}
Bitrix\Main\Text\StringHelper
Definition:
main/lib/text/stringhelper.php:17
Bitrix\Main\Text\StringHelper\snake2camel
static snake2camel($str)
Changes registry from snake_case or SNAKE_CASE to CamelCase.
Definition:
main/lib/text/stringhelper.php:56
Bitrix\Main\Text\StringHelper\strtoupper
static strtoupper($str)
Regular uppercase with result cache.
Definition:
main/lib/text/stringhelper.php:25
Bitrix\Main\Text\StringHelper\camel2snake
static camel2snake($str)
Changes registry from CamelCase to snake_case.
Definition:
main/lib/text/stringhelper.php:44
Bitrix\Main\Text
Definition:
base32.php:2
modules
main
lib
text
stringhelper.php
Создано системой
1.9.1