Skip to content

An object that can intelligently determine whether to use grapheme_* or byte-focused string functions

License

Notifications You must be signed in to change notification settings

navarr/smartstring

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Apr 29, 2024
1356cc9 · Apr 29, 2024

History

5 Commits
Mar 7, 2022
Mar 7, 2022
Mar 7, 2022
Mar 7, 2022
Mar 7, 2022
Apr 29, 2024
Mar 7, 2022
Mar 7, 2022
Mar 7, 2022
Mar 7, 2022
Mar 7, 2022

Repository files navigation

Fast, Appropriate String Manipulation

SmartString is a library that automatically determines whether a string of text can use PHP's byte manipulation tools, or if it needs to be upgraded to use Grapheme manipulations - allowing you to process text as quickly and as accurately as possible.

Installation

composer require navarr/smartstring

Usage

use Navarr\SmartString\SmartStringFactory;
use Navarr\SmartString\SmartString;

// Factory Methodology
$factory = new SmartStringFactory();
$example = $factory->create('🏴󠁧󠁢󠁥󠁮󠁧󠁿');
echo $example->strlen(); // 1

// Singleton Methodology
$example = SmartString::build('Test');
echo $example->strlen(); // 4

About

An object that can intelligently determine whether to use grapheme_* or byte-focused string functions

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages