Dark Mode

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

navarr/smartstring

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

strlen(); // 1 // Singleton Methodology $example = SmartString::build('Test'); echo $example->strlen(); // 4">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

Topics

Resources

Readme

License

MIT license

Stars

Watchers

Forks

Sponsor this project

Packages

Contributors

Languages