2017 © Pedro Peláez
 

library string

String utilities

image

zenstruck/string

String utilities

  • Tuesday, October 25, 2016
  • by kbond
  • Repository
  • 1 Watchers
  • 2 Stars
  • 18,582 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 7 Versions
  • 4 % Grown

The README.md

zenstruck/string

Build Status Code Coverage StyleCI Latest Stable Version License, (*1)

Various string utility functions for PHP. A Twig Extension is available., (*2)

Installation

composer require zenstruck/string

Usage

remove_whitespace

Replaces   with a single space and converts multiple sequential spaces into a single space., (*3)

$ret = remove_whitespace("  foo     \n\n\n  \r  bar"); // $ret = "foo bar"

null_trim

Similar to core "trim" but returns null instead of an empty string. When an array is passed, all elements get processed recursively., (*4)

$ret = null_trim(" foo  bar   "); // $ret = "foo bar"

$ret = null_trim("   "); // $ret = null

$ret = null_trim(array(" foo  bar   ", "   ")); // $ret = array("foo bar", null)

$ret = null_trim("foo / ", "/ "); // $ret = "foo"

truncate_word

Truncates text to a length without breaking words (calls remove_whitespace before truncating)., (*5)

$ret = truncate_word("      foo       bar  baz", 10); // $ret = "foo bar..."

The Versions

25/10 2016

dev-master

9999999-dev http://zenstruck.com/projects/string

String utilities

  Sources   Download

MIT

string

25/10 2016

v2.0.0

2.0.0.0 http://zenstruck.com/projects/string

String utilities

  Sources   Download

MIT

string

25/10 2016

1.x-dev

1.9999999.9999999.9999999-dev http://zenstruck.com/projects/string

String utilities (null_trim, remove_whitespace, truncate_word).

  Sources   Download

MIT

string

25/10 2016

v1.0.2

1.0.2.0 http://zenstruck.com/projects/string

String utilities (null_trim, remove_whitespace, truncate_word).

  Sources   Download

MIT

string

25/02 2016

v1.0.1

1.0.1.0 http://zenstruck.com/projects/string

String utilities (null_trim, remove_whitespace, truncate_word).

  Sources   Download

MIT

string

24/02 2016

v1.0.0

1.0.0.0 http://zenstruck.com/projects/string

String utilities (null_trim, remove_whitespace, truncate_word).

  Sources   Download

MIT

string

16/09 2014

v0.1.0

0.1.0.0 http://zenstruck.com/projects/string

String utilities.

  Sources   Download

MIT

The Development Requires

string