Documentation

Str
in package

FinalYes

Utilities for strings.

Tags
since
1.0

Table of Contents

Methods

trim_prefix()  : string
Trims a string prefix when it matches. Example: `trim_prefix("Hello all", "Hello ") === "all"`.
trim_suffix()  : string
Trims a string suffix when it matches. Example: `trim_suffix("Hello all", " all") === "Hello"`.

Methods

trim_prefix()

Trims a string prefix when it matches. Example: `trim_prefix("Hello all", "Hello ") === "all"`.

public static trim_prefix(string $string, string $prefix) : string
Parameters
$string : string

the original string

$prefix : string

the prefix to remove

Tags
since
1.0
Return values
string

the resulting string

trim_suffix()

Trims a string suffix when it matches. Example: `trim_suffix("Hello all", " all") === "Hello"`.

public static trim_suffix(string $string, string $suffix) : string
Parameters
$string : string

the original string

$suffix : string

the suffix to remove

Tags
since
1.0
Return values
string

the resulting string


        
On this page

Search results