jpuck/mbstring

Methods for handling multibyte string manipulations.

0.1.0 2017-10-24 22:54 UTC

This package is not auto-updated.

Last update: 2025-03-02 07:42:08 UTC


README

Methods for handling multibyte string manipulations.

Build Status Codecov

Installation

via composer:

composer require jpuck/mbstring

Usage

See the tests for more examples.

Case Map

Creates an index of uppercase character positions in a string that can be mapped to other strings.

$original = '馃敟 Fo贸, fo贸 FO脫 馃榿';
$casemap = new CaseMap($original);
$replaced = mb_eregi_replace('fo贸', 'b氓r', $original);
$restored = $casemap->transform($replaced);

echo "original: $original\n";
echo "replaced: $replaced\n";
echo "restored: $restored\n";
original: 馃敟 Fo贸, fo贸 FO脫 馃榿  
replaced: 馃敟 b氓r, b氓r b氓r 馃榿  
restored: 馃敟 B氓r, b氓r B脜R 馃榿