Skip to content

truonggiangphp/wstring

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

webikevn/wstring

This librairy provides utilities function to ease string manipulation

Install

Install package with composer

composer require webikevn/wstring

In your PHP code, load library

require_once __DIR__ . '/../vendor/autoload.php';
use Webike\WString\WString as WString;

Note: I couldn't use String as namespace because it's a PHP reserved word so it's why namespace is WString ...

Usage

Replace the last occurrence of a string

$string = WString::strReplaceLast($search, $replace, $subject);

Checks whether a string starts with given chars

$bool = WString::startsWith($haystack, $needle);

Checks whether a string ends with given chars

$bool = WString::endsWith($haystack, $needle);

Unit Tests

phpunit --bootstrap vendor/autoload.php tests

Author

Nguyen Giang visit my website ;)