Documentation

Str
in package

String utility methods.

Tags
author

ju1ius

Table of Contents

UNVIS_RX  = <<<'EOS' / \(?: ((?:040)|s) | (240) | (?: M-(.) ) | (?: M^(.) ) | (?: ^(.) ) ) /xS EOS
unvis()  : string
Decodes a string encoded by libsd's strvis.
unvisReplace()  : string
Callback for Str::unvis.

Constants

UNVIS_RX

public mixed UNVIS_RX = <<<'EOS' / \(?: ((?:040)|s) | (240) | (?: M-(.) ) | (?: M^(.) ) | (?: ^(.) ) ) /xS EOS

Methods

unvis()

Decodes a string encoded by libsd's strvis.

public static unvis(string $input) : string

From man 3 vis:

Use an ‘M’ to represent meta characters (characters with the 8th bit set), and use a caret ‘^’ to represent control characters (see iscntrl(3)). The following formats are used:

 \040    Represents ASCII space.

 \240    Represents Meta-space (&nbsp in HTML).

 \M-C    Represents character ‘C’ with the 8th bit set.
         Spans characters ‘\241’ through ‘\376’.

 \M^C    Represents control character ‘C’ with the 8th bit set.
         Spans characters ‘\200’ through ‘\237’, and ‘\377’ (as ‘\M^?’).

 \^C     Represents the control character ‘C’.
         Spans characters ‘\000’ through ‘\037’, and ‘\177’ (as ‘\^?’).

The other formats are supported by PHP's stripcslashes, except for the \s sequence (ASCII space).

Parameters
$input : string

The string to decode

Return values
string

unvisReplace()

Callback for Str::unvis.

protected static unvisReplace(array<string|int, mixed> $match) : string
Parameters
$match : array<string|int, mixed>

The matches passed by preg_replace_callback

Return values
string

Search results