You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Then, after running composer update or php composer.phar update, you can
load the class using Composer's autoloader:
require'vendor/autoload.php';
Overview
SliceableStringy returns a slice when passed a string offset containing
one or more colons. Up to 3 arguments may be passed: 'start:stop:step'.
Start, which indicates the starting index of the slice, defaults to the first
character in the string if step is positive, and the last character if negative.
Stop, which indicates the exclusive boundary of the range, defaults to the
length of the string if step is positive, and before the first character if
negative. And step allows the user to include only every nth character in the
result, with its sign determining the direction in which indices are sampled.
Just like Stringy, SliceableStringy is immutable and returns a new
instance with each slice.
$sliceable[20]; // OutOfBoundsException$sliceable['1:2:3:4']; // InvalidArgumentException, too many slice args$sliceable['::0']; // InvalidArgumentException, step cannot equal 0
Implementation Fidelity
A number of specs in spec/SliceableStringySpec.php assert that the library
mimics Python's native slice notation. On top of the handful of unit tests,
spec/fixtures/resultGenerator.py has been used to generate test fixtures.
Each of the slices in expectedResults.csv are checked against SliceableStringy
to ensure correct functionality.