Download the PHP package andydune/custom-string-explode without Composer
On this page you can find all versions of the php package andydune/custom-string-explode. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download andydune/custom-string-explode
More information about andydune/custom-string-explode
Files in andydune/custom-string-explode
Package custom-string-explode
Short Description Explode string using custom user rules.
License MIT
Homepage https://github.com/AndyDune/CustomStringExplode
Informations about the package custom-string-explode
CustomStringExplode
Explode string using user custom rules.
Installation
Installation using composer:
Or if composer was not installed globally:
Or edit your composer.json
:
And execute command:
Instruction
There is any string we want to convert into array. String may be set of numbers with any delimiters, it can be email set and more.
It is better to see how it works for on specific points.
Rule: Numbers
Rule: Emails
Rule: NumbersAndLatinLetters
I used it for extract hashes from any texts.
Rule: DelimiterWhitespaceCharacter
It helps to explode string with any white space delimiter.
Create custom rules
You may build your onw rules for explode strings as you wish. All rules mast implement RuleAbstract
interface.
Lets look at the code:
You need to define method check
surely. This method returns boolean value:
true
- current char may be the part of stringfalse
- current char is separator
Overload method format
for final check every result array item. It make trim by default.
Method may returns null
or false
if item must be deleted from array.
All versions of custom-string-explode with dependencies
ext-mbstring Version *