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: 2024-04-14 02:13:28 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 😁