2017 © Pedro Peláez
 

library string

PHP 5.3 String manipulation library

image

dmeroff/string

PHP 5.3 String manipulation library

  • Monday, July 15, 2013
  • by dmeroff
  • Repository
  • 1 Watchers
  • 2 Stars
  • 29 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

String Build Status

String class

String is a class that turns string into PHP objects. It implements a fluent interface, improving how we manipulate strings, and extends functionality by providing common functions., (*1)

Imagine that you need to replace "hello" to "goodbye" and make first letter uppercase. In classic PHP it would like something like this:, (*2)

$string = 'hello, world';
$string = str_replace('hello', 'goodbye', $string);
$string = ucfirst($string);
echo $string; // Goodbye, world

Using the String class it gets simpler:, (*3)

$string = 'hello, world';
$string = new String\String($string);
echo $string->replace('hello', 'goodbye')->sentencecase(); // Goodbye, world

OR, (*4)

$string = 'hello, world';
echo String\String::make($string)->replace('hello', 'goodbye')->sentencecase(); // Goodbye, world

LetterPairSimilarity class

This class can be used to compare string using "Strike a match" algorithm., (*5)

$similarity = String\LetterPairSimilarity::compare('Healed', 'Healthy');
echo round($similarity, 2); // 0.55

Requirements

  • PHP 5.3 and higher
  • mbstring extension

The Versions

15/07 2013

dev-master

9999999-dev

PHP 5.3 String manipulation library

  Sources   Download

MIT

string

15/07 2013

v1.0

1.0.0.0

PHP 5.3 String manipulation library

  Sources   Download

MIT

string