rasmusrosengren/string-diff 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

rasmusrosengren/string-diff

Composer 安装命令:

composer require rasmusrosengren/string-diff

包简介

A class to extract variables in identically formatted string with only small differences

README 文档

README

StringDiff is a small plugin that allows easy manipulation of similarly formatted strings, with very small differences at same places.

Usage

new StringDiff
$stringd = new StringDiff;

$test_array = [
    "Your Cooldown Reduction cap is increased to 41% and you gain 1% Cooldown Reduction",
    "Your Cooldown Reduction cap is increased to 42% and you gain 2% Cooldown Reduction",
    "Your Cooldown Reduction cap is increased to 43% and you gain 3% Cooldown Reduction",
    "Your Cooldown Reduction cap is increased to 44% and you gain 4% Cooldown Reduction",
    "Your Cooldown Reduction cap is increased to 45% and you gain 5% Cooldown Reduction",
];

$stringd->run($test_array);
foreach($stringd->getArgs() as $arg)
{
    echo vsprintf($stringd->getUnformattedString(), $arg) . '<br>';
}

The run(array $arr) method processes the array of data and outputs the unformatted string and an array of arguments, the unformatted string contains %s which in turns are replaces by the arguments using vsprintf($unformatted string, array $args) after manipulation.

The getUnformattedString() method returns the unformatted string which contains the %s placeholders.

The getArgs() returns an array of arguments formatted as following:

0 => [
    0 => 41
    1 => 1
],
1 => [
  0 => 42,
  1 => 2
]
...

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-08-07

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固