Cecil

Str

String utility class.

This class provides utility methods for string manipulation.

Table of Contents

Methods

arrayToList()  : string
Returns a string representation of an array.
combineArrayToString()  : string
Combines an array into a string.
endsWith()  : bool
Checks if a string ends with the given string.
startsWith()  : bool
Checks if a string starts with the given string.
strToBool()  : bool|mixed
Converts 'true', 'false', 'on', 'off', 'yes', 'no' to a boolean.

Methods

arrayToList()

Returns a string representation of an array.

public static arrayToList(array<string|int, mixed> $array) : string
Parameters
$array : array<string|int, mixed>
Return values
string

combineArrayToString()

Combines an array into a string.

public static combineArrayToString(array<string|int, mixed> $array, string $keyToKey, string $keyToValue[, string $separator = ':' ]) : string
Parameters
$array : array<string|int, mixed>
$keyToKey : string

The key that become the key of the new array

$keyToValue : string

The key that become the value of the new array

$separator : string = ':'

The separtor between the key and the value in the result string

Return values
string

endsWith()

Checks if a string ends with the given string.

public static endsWith(string $haystack, string $needle) : bool
Parameters
$haystack : string
$needle : string
Return values
bool

startsWith()

Checks if a string starts with the given string.

public static startsWith(string $haystack, string $needle) : bool
Parameters
$haystack : string
$needle : string
Return values
bool

strToBool()

Converts 'true', 'false', 'on', 'off', 'yes', 'no' to a boolean.

public static strToBool(mixed $value) : bool|mixed
Parameters
$value : mixed

Value to convert

Return values
bool|mixed
 
On this page

Search results