Author: Nickolas Burr
If you would like to receive updates (like this one) by email, please consider subscribing to our quarterly newsletter. It is low volume, and includes details about upcoming releases, product updates, EOL announcements, and other related topics. You can subscribe here.
Parsing and manipulating strings is an integral part of building software, especially software in the context of web-based applications. In PHP, frequent tasks can include:
Trim whitespace from string
Split string into array of substrings
Join array of strings into single
These tasks are so inherently common that if you scrutinize any PHP framework of choice, you’re bound to find many instances of expressions like:
To be clear, there is absolutely nothing wrong with any of those expressions, fundamental
or otherwise. However, if you look closely, you will notice a pattern, which is that the
overwhelming majority of instances are trimming, splitting, joining, etc. the same maybe
four or so characters, like
_. These tasks were frequent
enough that we desired character-specific functions for each of these use cases, so we
put together a compact library to achieve just that.
libxstring v1.0.0 is now available on GitHub.