2017 © Pedro Peláez
 

library string-utils

A collection of string utilities for PHP, loosely based on the LambdaMOO $string_utils package.

image

sevenecks/string-utils

A collection of string utilities for PHP, loosely based on the LambdaMOO $string_utils package.

  • Wednesday, April 4, 2018
  • by sevenecks
  • Repository
  • 1 Watchers
  • 0 Stars
  • 31 Installations
  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 16 Versions
  • 0 % Grown

The README.md

StringUtils

A set of common string functions, loosely based on LambdaMOO $string_utils. It uses sevenecks/ansi to add color where applicable though you can pass your own colorizer in via dependency injection., (*1)

Installation

Via Composer, (*2)

composer require sevenecks/string-utils

Usage

require_once __DIR__ . '/../vendor/autoload.php';
use SevenEcks\StringUtils\StringUtils;
use SevenEcks\Ansi\Colorize;

$su = new StringUtils;
$test_string = 'This is a test';
// echo out test string
$su->tell($test_string);
$su->setLineLength(10);
// echo out a string, ignores line len
$su->tell($su->colorize->red("This is a test of a long red string!"));
$su->setSplitMidWord(true);
// echo using line length and color color
$su->tell($su->colorize->red($su->wordWrap("This is a test of a long blue word wrapped string which breaks mid word!")));
$su->setSplitMidWord(false);
// echo using length and color color
$su->tell($su->colorize->blue($su->wordWrap("This is a test of a long blue word wrapped string which breaks at a word!")));
// set the line length break string to br instead of default of \n
$su->setBreakString("<br />");
$su->tell($su->colorize->red($su->wordWrap("This is a test of a long red string!")));
$su->tell("Not colored.");
// mass colorize a string wrapped by line
$su->tell_lines($su->massColor($su->lineWrap("This is a test of a long line wrapped red strings!"), 'blue'));
// break at specific linelen
$su->tell_lines($su->lineWrap('123456789123456789123456789'));
// formatting of left, right, and center
$su->tell($su->left("TEST", 10) . $su->left("TEST1", 10));
$su->tell($su->right("TEST", 10) . $su->right("TEST1", 10));
$su->tell($su->center("TEST", 10) . $su->center("TEST1", 10));
// update line len
$su->setLineLength(180);
// center
$su->tell($su->center("CENTER NO ARGS"));
$su->tell($su->center("CENTER W/ ARGS", 30));
// alerts crits and warnings for debugging
$su->alert("This is an alert!");
$su->warning("This is a warning");
$su->critical("This is critical!");
// using tostr to combine args into a string
$su->tell($su->tostr($su->center("THIS EXAMPLE", 10), ' ', $su->center("USES TOSTR", 10), ' ', 1,2,3));
$su->tell($su->tostr('1',2,'3','asdf',['a', 'b' => 'c', 1]));

Example Output, (*3)

Change Log

Please see Change Log for more information., (*4)

License

The MIT License (MIT). Please see License File for more information., (*5)

The Versions

04/04 2018

dev-master

9999999-dev https://github.com/sevenecks

A collection of string utilities for PHP, loosely based on the LambdaMOO $string_utils package.

  Sources   Download

MIT

The Requires

 

by Brendan Butts

console cli command line shell string formatting lambdamoo

03/04 2018

0.0.15

0.0.15.0 https://github.com/sevenecks

A collection of string utilities for PHP, loosely based on the LambdaMOO $string_utils package.

  Sources   Download

MIT

The Requires

 

by Brendan Butts

console cli command line shell string formatting lambdamoo

23/03 2018

0.0.13

0.0.13.0 https://github.com/sevenecks

A collection of string utilities for PHP, loosely based on the LambdaMOO $string_utils package.

  Sources   Download

MIT

The Requires

 

by Brendan Butts

console cli command line shell string formatting lambdamoo

23/03 2018

0.0.14

0.0.14.0 https://github.com/sevenecks

A collection of string utilities for PHP, loosely based on the LambdaMOO $string_utils package.

  Sources   Download

MIT

The Requires

 

by Brendan Butts

console cli command line shell string formatting lambdamoo

21/03 2018

0.0.12

0.0.12.0 https://github.com/sevenecks

A collection of string utilities for PHP, loosely based on the LambdaMOO $string_utils package.

  Sources   Download

MIT

The Requires

 

by Brendan Butts

console cli command line shell string formatting lambdamoo

20/03 2018

0.0.11

0.0.11.0 https://github.com/sevenecks

A collection of string utilities for PHP, loosely based on the LambdaMOO $string_utils package.

  Sources   Download

MIT

The Requires

 

by Brendan Butts

console cli command line shell string formatting lambdamoo

22/12 2017

0.0.10

0.0.10.0 https://github.com/sevenecks

A collection of string utilities for PHP, loosely based on the LambdaMOO $string_utils package.

  Sources   Download

MIT

The Requires

 

by Brendan Butts

console cli command line shell string formatting lambdamoo

22/12 2017

0.0.9

0.0.9.0 https://github.com/sevenecks

A collection of string utilities for PHP, loosely based on the LambdaMOO $string_utils package.

  Sources   Download

MIT

The Requires

 

by Brendan Butts

console cli command line shell string formatting lambdamoo

12/12 2017

0.0.8

0.0.8.0 https://github.com/sevenecks

A collection of string utilities for PHP, loosely based on the LambdaMOO $string_utils package.

  Sources   Download

MIT

The Requires

 

by Brendan Butts

console cli command line shell string formatting lambdamoo

12/12 2017

0.0.7

0.0.7.0 https://github.com/sevenecks

A collection of string utilities for PHP, loosely based on the LambdaMOO $string_utils package.

  Sources   Download

MIT

The Requires

 

by Brendan Butts

console cli command line shell string formatting lambdamoo

12/12 2017

0.0.5

0.0.5.0 https://github.com/sevenecks

A collection of string utilities for PHP, loosely based on the LambdaMOO $string_utils package.

  Sources   Download

MIT

The Requires

 

by Brendan Butts

console cli command line shell string formatting lambdamoo

12/12 2017

0.0.6

0.0.6.0 https://github.com/sevenecks

A collection of string utilities for PHP, loosely based on the LambdaMOO $string_utils package.

  Sources   Download

MIT

The Requires

 

by Brendan Butts

console cli command line shell string formatting lambdamoo

12/12 2017

0.0.4

0.0.4.0 https://github.com/sevenecks

A collection of string utilities for PHP, loosely based on the LambdaMOO $string_utils package.

  Sources   Download

MIT

The Requires

 

by Brendan Butts

console cli command line shell string formatting lambdamoo

12/12 2017

0.0.3

0.0.3.0 https://github.com/sevenecks

A collection of string utilities for PHP, loosely based on the LambdaMOO $string_utils package.

  Sources   Download

MIT

The Requires

 

by Brendan Butts

console cli command line shell string formatting lambdamoo

12/12 2017

0.0.2

0.0.2.0 https://github.com/sevenecks

A collection of string utilities for PHP, loosely based on the LambdaMOO $string_utils package.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Brendan Butts

console cli command line shell string formatting lambdamoo

12/12 2017

0.0.1

0.0.1.0 https://github.com/sevenecks

A collection of string utilities for PHP, loosely based on the LambdaMOO $string_utils package.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Brendan Butts

console cli command line shell string formatting lambdamoo