https://github.com/navarr/smartstring
An object that can intelligently determine whether to use grapheme_* or byte-focused string functions
https://github.com/navarr/smartstring
Last synced: 7 months ago
JSON representation
An object that can intelligently determine whether to use grapheme_* or byte-focused string functions
- Host: GitHub
- URL: https://github.com/navarr/smartstring
- Owner: navarr
- License: mit
- Created: 2022-03-07T01:50:16.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2024-04-29T15:47:16.000Z (about 2 years ago)
- Last Synced: 2024-12-29T06:22:26.108Z (over 1 year ago)
- Language: PHP
- Size: 35.2 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# 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
```php
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
```