Adventure Documentation

Strings extends PlatformUtility
in package

Provides access to strings utility functions.

Tags

Table of Contents

contains()  : bool
Check if a string contains another string.
decodeHTML()  : string
Decode all HTML entities in a string.
empty()  : bool
Check is string is null or blank.
encodeHTML()  : string
Encodes all HTML entities in a string.
formatLink()  : string
Format a string to a link
length()  : int
Get the length of a string.
md5()  : string
Encodes string with md5.
replace()  : string
Replace part of a string with another string.
replaceAll()  : string
Replace multiple parts of a string by using associative array
split()  : array<string|int, mixed>
Split of string into an array.
startsWith()  : bool
Check if a string starts with another string.
stripHTML()  : string
Strip all HTML tags from a string.
stripslashes()  : string
Stripslashes from a string.
toLowerCase()  : string
Convert a string to lower case.
toUpperCase()  : string
Convert a string to upper case.
truncate()  : string
Truncates a string and appends an ellipsis onto the end if it exceeds the specified max length.

Methods

contains()

Check if a string contains another string.

public contains(string|null $string, string $search) : bool

If the string provided is null, this function returns false.

Parameters
$string : string|null
$search : string
Tags
see
str_contains()
Return values
bool

decodeHTML()

Decode all HTML entities in a string.

public decodeHTML(string|null $string[, mixed $encoding = null ]) : string

If the string provided is null, this function returns an empty string.

Parameters
$string : string|null
$encoding : mixed = null
Tags
Return values
string

empty()

Check is string is null or blank.

public empty(string|null $string) : bool
Parameters
$string : string|null
Tags
see
empty()
Return values
bool

encodeHTML()

Encodes all HTML entities in a string.

public encodeHTML(string|null $string[, mixed $encoding = null ]) : string

If the string provided is null, this function returns an empty string.

Parameters
$string : string|null
$encoding : mixed = null
Tags
Return values
string

Format a string to a link

public formatLink(string $string) : string
Parameters
$string : string
Tags
Return values
string

length()

Get the length of a string.

public length(string|null $string) : int

If the string provided is null, this function assumes lenght is 0.

Parameters
$string : string|null
Tags
see
strlen()
Return values
int

md5()

Encodes string with md5.

public md5(string $string) : string
Parameters
$string : string
Tags
see
md5()
Return values
string

replace()

Replace part of a string with another string.

public replace(string|null $string, string $search, string $replace) : string

If the string provided is null, this function returns an empty string.

Parameters
$string : string|null
$search : string
$replace : string
Tags
see
str_replace()
Return values
string

replaceAll()

Replace multiple parts of a string by using associative array

public replaceAll(string|null $string, array<string|int, mixed> $replace) : string

If the string provided is null, this function returns an empty string.

Parameters
$string : string|null
$replace : array<string|int, mixed>
Tags
see
strtr()
Return values
string

split()

Split of string into an array.

public split(string|null $string[, string $separator = "," ]) : array<string|int, mixed>

If the string provided is null, this function returns an empty array.

Parameters
$string : string|null
$separator : string = ","
Tags
see
explode()
Return values
array<string|int, mixed>

startsWith()

Check if a string starts with another string.

public startsWith(string|null $string, string $search) : bool

If the string provided is null, this function returns false.

Parameters
$string : string|null
$search : string
Tags
see
str_replace()
Return values
bool

stripHTML()

Strip all HTML tags from a string.

public stripHTML(string|null $string[, mixed $allowed_tags = null ]) : string

If the string provided is null, this function returns an empty string.

Parameters
$string : string|null
$allowed_tags : mixed = null
Tags
Return values
string

stripslashes()

Stripslashes from a string.

public stripslashes(string|null $string) : string
Parameters
$string : string|null
Tags
Return values
string

toLowerCase()

Convert a string to lower case.

public toLowerCase(string|null $string) : string

If the string provided is null, this function returns an empty string.

Parameters
$string : string|null
Tags
Return values
string

toUpperCase()

Convert a string to upper case.

public toUpperCase(string|null $string) : string

If the string provided is null, this function returns an empty string.

Parameters
$string : string|null
Tags
Return values
string

truncate()

Truncates a string and appends an ellipsis onto the end if it exceeds the specified max length.

public truncate(string|null $string, int $length[, string $ellipsis = "..." ]) : string

If the string provided is null, this function returns an empty string.

Parameters
$string : string|null
$length : int
$ellipsis : string = "..."
Tags
Return values
string

        

Search results