Skip to content

jstewmc/expand-abbreviations

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

expand-abbreviations

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

About

Expand abbreviations in a string.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages