2017 © Pedro Peláez
 

library php-number-range-string

Support calculations on day ranges (e.g. 1-2, 4, ...)

image

warriorgod/php-number-range-string

Support calculations on day ranges (e.g. 1-2, 4, ...)

  • Thursday, April 6, 2017
  • by warriorGod
  • Repository
  • 1 Watchers
  • 0 Stars
  • 6 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

php-number-range-string

Generate and modify number ranges in a string format., (*1)

Features

  • number ranges can be defined as a string, array or number (e.g. 3 as a single day range)
  • ranges can be negative
  • only tested on growing ranges (e.g from <= to)
  • separator is "-" by default, but can be configured in array notation and when parsing.

Usage

Please see tests for some examples. Here are a few., (*2)

NumberRangeString::fromRange('1-5')->moveBy(2) // 3-7
NumberRangeString::fromRange('1-20')->expand(new NumberRangeString('5-21')) // 1-21
NumberRangeString::fromRange('1-2')->countInclusive() // 2
NumberRangeString::fromRange('1-2')->countExclusive() // 0
NumberRangeString::fromRange('1-2')->countNumeric() // 1
NumberRangeString::fromRange('1-1')->countNumeric() // 0
NumberRangeString::fromRange('-5--1')->moveTo(1) // 1-5
new NumberRangeString([5,10, ' to ']) // 5 to 10
NumberRangeString::fromRange([5,10, ' to '])->add(1) // 6 to 11

The Versions

06/04 2017

dev-master

9999999-dev

Support calculations on day ranges (e.g. 1-2, 4, ...)

  Sources   Download

MIT

The Development Requires

by gregor tramsak

06/04 2017

v1.0.0

1.0.0.0

Support calculations on day ranges (e.g. 1-2, 4, ...)

  Sources   Download

MIT

The Development Requires

by gregor tramsak