\Mine\HelperStr

Summary

Methods
Properties
Constants
contains()
endsWith()
startsWith()
random()
lower()
upper()
length()
substr()
snake()
camel()
studly()
title()
ipToRegion()
Sec2Time()
getUUID()
replaceFirst()
No public properties found
No constants found
No protected methods found
$snakeCache
$camelCache
$studlyCache
N/A
No private methods found
No private properties found
N/A

Properties

$snakeCache

$snakeCache : 

Type

$camelCache

$camelCache : 

Type

$studlyCache

$studlyCache : 

Type

Methods

contains()

contains(string  $haystack, string|array  $needles) : boolean

检查字符串中是否包含某些字符串

Parameters

string $haystack
string|array $needles

Returns

boolean

endsWith()

endsWith(string  $haystack, string|array  $needles) : boolean

检查字符串是否以某些字符串结尾

Parameters

string $haystack
string|array $needles

Returns

boolean

startsWith()

startsWith(string  $haystack, string|array  $needles) : boolean

检查字符串是否以某些字符串开头

Parameters

string $haystack
string|array $needles

Returns

boolean

random()

random(integer  $length = 6, integer  $type = -1, string  $addChars = '') : string

获取指定长度的随机字母数字组合的字符串

Parameters

integer $length
integer $type
string $addChars

Returns

string

lower()

lower(string  $value) : string

字符串转小写

Parameters

string $value

Returns

string

upper()

upper(string  $value) : string

字符串转大写

Parameters

string $value

Returns

string

length()

length(string  $value) : integer

获取字符串的长度

Parameters

string $value

Returns

integer

substr()

substr(string  $string, integer  $start, integer|null  $length = null) : string

截取字符串

Parameters

string $string
integer $start
integer|null $length

Returns

string

snake()

snake(string  $value, string  $delimiter = '_') : string

驼峰转下划线

Parameters

string $value
string $delimiter

Returns

string

camel()

camel(string  $value) : string

下划线转驼峰(首字母小写)

Parameters

string $value

Returns

string

studly()

studly(string  $value) : string

下划线转驼峰(首字母大写)

Parameters

string $value

Returns

string

title()

title(string  $value) : string

转为首字母大写的标题格式

Parameters

string $value

Returns

string

ipToRegion()

ipToRegion(string  $ip) : string

获取IP的区域地址

Parameters

string $ip

Throws

\Psr\Container\ContainerExceptionInterface
\Psr\Container\NotFoundExceptionInterface

Returns

string

Sec2Time()

Sec2Time(  $time) : string

秒数转时分格式

Parameters

$time

int

Returns

string

getUUID()

getUUID() : string

生成UUID

Returns

string

replaceFirst()

replaceFirst(\Mine\Helper\string  $search, \Mine\Helper\string  $replace, \Mine\Helper\string  $subject, \Mine\Helper\int  $offset) 

Replace the first occurrence of a given value in the string.

Parameters

\Mine\Helper\string $search
\Mine\Helper\string $replace
\Mine\Helper\string $subject
\Mine\Helper\int $offset