class StringUtilities

Methods

static string
pad(string $input, int $padLength, string $padString = ' ', int $padType = STR_PAD_RIGHT, string $encoding = '')

Pads a multibyte string to a certain length with another string

static bool
isSupportedEncoding(string $encoding)

No description

static bool
startsWith(string $string, string $start) deprecated

No description

static bool
endsWith(string $string, string $end) deprecated

No description

static bool
contains(string $string, string $needle) deprecated

No description

static string
encodeInBase64(string $string)

Encode a string using a variant of the MIME base64 compatible with URLs.

static string
decodeFromBase64(string $string)

Decode a string encoded with StringUtilities::encodeInBase64

Details

at line 20
static string pad(string $input, int $padLength, string $padString = ' ', int $padType = STR_PAD_RIGHT, string $encoding = '')

Pads a multibyte string to a certain length with another string

Parameters

string $input

the input string

int $padLength

the target string size

string $padString

the padding characters (optional, default is space)

int $padType

STR_PAD_RIGHT, STR_PAD_LEFT, or STR_PAD_BOTH (optional, default is STR_PAD_RIGHT)

string $encoding

the character encoding (optional)

Return Value

string

the padded string

at line 36
static bool isSupportedEncoding(string $encoding)

No description

Parameters

string $encoding

Return Value

bool

at line 46
static bool startsWith(string $string, string $start) deprecated

deprecated Since PHP 8.0, we can replace by \str_starts_with

No description

Parameters

string $string
string $start

Return Value

bool

at line 54
static bool endsWith(string $string, string $end) deprecated

deprecated Since PHP 8.0, we can replace by \str_ends_with

No description

Parameters

string $string
string $end

Return Value

bool

at line 62
static bool contains(string $string, string $needle) deprecated

deprecated Since PHP 8.0, we can replace by \str_contains

No description

Parameters

string $string
string $needle

Return Value

bool

at line 75
static string encodeInBase64(string $string)

Encode a string using a variant of the MIME base64 compatible with URLs.

The '+' and '/' characters used in base64 are replaced by '-' and '_'. The '=' padding is removed.

Parameters

string $string

The string to encode

Return Value

string

The encoded string

at line 89
static string decodeFromBase64(string $string)

Decode a string encoded with StringUtilities::encodeInBase64

Parameters

string $string

The string to decode

Return Value

string

The decoded string