承接 bradleyboy/range-converter 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

bradleyboy/range-converter

最新稳定版本:0.1.0

Composer 安装命令:

composer require bradleyboy/range-converter

包简介

Simple class that creates compact string representations of integer arrays. Can also convert those strings back to an array.

README 文档

README

This simple class reduces arrays into compact strings by creating ranges when encountering neighboring integers. It can also expand strings with ranges back to the original array form.

Build Status

Examples

Reducing ranges:

$converter = new Bradleyboy\Util\RangeConverter;
$converter->reduce([1,2,3,4,7,9,10,11]); // Returns: '1..4,7,9..11'

Expanding ranges:

$converter = new Bradleyboy\Util\RangeConverter;
$converter->expand('1..4,7,9..11'); // Returns: [1,2,3,4,7,9,10,11]

You can also set custom separators:

$converter = new Bradleyboy\Util\RangeConverter;
$converter->setSeparator('.')
          ->setRangeSeparator('-')
          ->reduce([1,2,3,4,7,9,10,11]); // Returns: '1-4.7.9-11'

For more examples, see src/Bradleyboy/Util/RangeConverterTest.php.

统计信息

  • 总下载量: 92
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 4
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-11-20