定制 dmeroff/string 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

dmeroff/string

Composer 安装命令:

composer require dmeroff/string

包简介

PHP 5.3 String manipulation library

关键字:

README 文档

README

String class

String is a class that turns string into PHP objects. It implements a fluent interface, improving how we manipulate strings, and extends functionality by providing common functions.

Imagine that you need to replace "hello" to "goodbye" and make first letter uppercase. In classic PHP it would like something like this:

$string = 'hello, world';
$string = str_replace('hello', 'goodbye', $string);
$string = ucfirst($string);
echo $string; // Goodbye, world

Using the String class it gets simpler:

$string = 'hello, world';
$string = new String\String($string);
echo $string->replace('hello', 'goodbye')->sentencecase(); // Goodbye, world

OR

$string = 'hello, world';
echo String\String::make($string)->replace('hello', 'goodbye')->sentencecase(); // Goodbye, world

LetterPairSimilarity class

This class can be used to compare string using "Strike a match" algorithm.

$similarity = String\LetterPairSimilarity::compare('Healed', 'Healthy');
echo round($similarity, 2); // 0.55

Requirements

  • PHP 5.3 and higher
  • mbstring extension

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2013-07-14

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固