jstewmc/expand-abbreviations

Expand abbreviations

v1.0.0 2017-05-29 23:20 UTC

This package is auto-updated.

Last update: 2024-10-29 05:16:23 UTC


README

A service to expand abbreviations:

namespace Jstewmc\ExpandAbbreviations;

// define replacements (i.e., replace "foo" with "bar")
$replacements = ['foo' => 'bar'];

// instantiate service
$service = new ExpandAbbreviations($replacements);

// expand abbreviations
$service('foo bar baz');   // returns "bar bar baz"
$service('foo. bar baz');  // returns "bar bar baz"
$service('qux');           // returns "qux"

Given an array of replacements indexed by abbreviation, this library will expand all occurences of an abbreviation in a string to its corresponding replacement.

Keep in mind, this library is case-sensitive but trailing-period agnostic.

Author

Jack Clayton

Version

0.1.0, May 29, 2017

  • Initial release

License

MIT