Download the PHP package moccalotto/stringy without Composer
On this page you can find all versions of the php package moccalotto/stringy. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download moccalotto/stringy
More information about moccalotto/stringy
Files in moccalotto/stringy
Package stringy
Short Description Easy, powerful and fluent string handling
License MIT
Homepage https://moccalotto.github.io/docs/stringy
Informations about the package stringy
Stringy
Easy, powerful and fluent string handling
Installation
To add this package as a local, per-project dependency to your project, simply add a dependency on
moccalotto/stringy
to your project's composer.json
file.
This can be done via composer:
Documentation
The Stringy
object is immutable. This means that all operations that return a new Stringy
instance
This means that you will not have to clone
the object if you need to do two different,
branching operations on a given string.
On the other hand, it is quite likely that you cannot identity-compare two stringy objects because they
are often very short-lived. In cases where you need to check if two stringy objects contain the same
string, we suggest using the is()
method. See the example below:
Constructors
Normal constructor.
Static factory.
Helper factory function.
Create a random string.
Get the content string.
String comparison
Length (characters)
Size (bytes)
Position of substring
Getting words and characters from the string.
You can get individual characters via the php array accessor language construct like so:
Map/transform the string
Example:
Fetch a substring
Fetch segments of a string based on searches.
Fetch the part of the string that comes after a given search term.
Fetch the part of the string that comes before a given search term.
Fetch the part of the string that resides between two search terms.
Remove parts of the string based on search terms.
Remove the part of the string that comes after the given search term.
Remove the part of the string that comes before the given search term.
Repetition
Repeating a string