Str
in package
Table of Contents
- contains() : bool
- Checks if a str contains another string
- length() : int
- A UTF-8 safe version of strlen()
- ltrim() : string
- Safe ltrim alternative
- rtrim() : string
- Safe rtrim alternative
- split() : array<string|int, mixed>
- Better alternative for explode() It takes care of removing empty values and it has a built-in way to skip values which are too short.
Methods
contains()
Checks if a str contains another string
public
static contains([string $string = null ], string $needle[, bool $caseInsensitive = false ]) : bool
Parameters
- $string : string = null
- $needle : string
- $caseInsensitive : bool = false
Return values
bool —length()
A UTF-8 safe version of strlen()
public
static length([string $string = null ]) : int
Parameters
- $string : string = null
Return values
int —ltrim()
Safe ltrim alternative
public
static ltrim(string $string[, string $trim = ' ' ]) : string
Parameters
- $string : string
- $trim : string = ' '
Return values
string —rtrim()
Safe rtrim alternative
public
static rtrim(string $string[, string $trim = ' ' ]) : string
Parameters
- $string : string
- $trim : string = ' '
Return values
string —split()
Better alternative for explode() It takes care of removing empty values and it has a built-in way to skip values which are too short.
public
static split(string $string[, string $separator = ',' ][, int $length = 1 ]) : array<string|int, mixed>
Parameters
- $string : string
-
The string to split
- $separator : string = ','
-
The string to split by
- $length : int = 1
-
The min length of values.
Return values
array<string|int, mixed> —An array of found values