![Stringy](http://danielstjules.com/github/stringy-logo.png)
A PHP string manipulation library with multibyte support. Offers both OO method
chaining and a procedural-style static wrapper. Tested and compatible with
PHP 5.3+ and HHVM. Inspired by underscore.string.js.
[![Build Status](https://api.travis-ci.org/danielstjules/Stringy.svg?branch=master)](https://travis-ci.org/danielstjules/Stringy)
* [Requiring/Loading](#requiringloading)
* [OO and Procedural](#oo-and-procedural)
* [Implemented Interfaces](#implemented-interfaces)
* [PHP 5.6 Creation](#php-56-creation)
* [Methods](#methods)
* [at](#at)
* [camelize](#camelize)
* [chars](#chars)
* [collapseWhitespace](#collapsewhitespace)
* [contains](#contains)
* [containsAll](#containsall)
* [containsAny](#containsany)
* [countSubstr](#countsubstr)
* [create](#create)
* [dasherize](#dasherize)
* [delimit](#delimit)
* [endsWith](#endswith)
* [ensureLeft](#ensureleft)
* [ensureRight](#ensureright)
* [first](#first)
* [getEncoding](#getencoding)
* [hasLowerCase](#haslowercase)
* [hasUpperCase](#hasuppercase)
* [htmlDecode](#htmldecode)
* [htmlEncode](#htmlencode)
* [humanize](#humanize)
* [indexOf](#indexof)
* [indexOfLast](#indexoflast)
* [insert](#insert)
* [isAlpha](#isalpha)
* [isAlphanumeric](#isalphanumeric)
* [isBlank](#isblank)
* [isHexadecimal](#ishexadecimal)
* [isJson](#isjson)
* [isLowerCase](#islowercase)
* [isSerialized](#isserialized)
* [isUpperCase](#isuppercase)
* [last](#last)
* [length](#length)
* [longestCommonPrefix](#longestcommonprefix)
* [longestCommonSuffix](#longestcommonsuffix)
* [longestCommonSubstring](#longestcommonsubstring)
* [lowerCaseFirst](#lowercasefirst)
* [pad](#pad)
* [padBoth](#padboth)
* [padLeft](#padleft)
* [padRight](#padright)
* [regexReplace](#regexreplace)
* [removeLeft](#removeleft)
* [removeRight](#removeright)
* [replace](#replace)
* [reverse](#reverse)
* [safeTruncate](#safetruncate)
* [shuffle](#shuffle)
* [slugify](#slugify)
* [startsWith](#startswith)
* [substr](#substr)
* [surround](#surround)
* [swapCase](#swapcase)
* [tidy](#tidy)
* [titleize](#titleize)
* [toAscii](#toascii)
* [toLowerCase](#tolowercase)
* [toSpaces](#tospaces)
* [toTabs](#totabs)
* [toTitleCase](#totitlecase)
* [toUpperCase](#touppercase)
* [trim](#trim)
* [trimLeft](#trimLeft)
* [trimRight](#trimRight)
* [truncate](#truncate)
* [underscored](#underscored)
* [upperCamelize](#uppercamelize)
* [upperCaseFirst](#uppercasefirst)
* [Links](#links)
* [Tests](#tests)
* [License](#license)
## Requiring/Loading
If you're using Composer to manage dependencies, you can include the following
in your composer.json file:
```json
{
"require": {
"danielstjules/stringy": "~1.10"
}
}
```
Then, after running `composer update` or `php composer.phar update`, you can
load the class using Composer's autoloading:
```php
require 'vendor/autoload.php';
```
Otherwise, you can simply require the file directly:
```php
require_once 'path/to/Stringy/src/Stringy.php';
// or
require_once 'path/to/Stringy/src/StaticStringy.php';
```
And in either case, I'd suggest using an alias.
```php
use Stringy\Stringy as S;
// or
use Stringy\StaticStringy as S;
```
## OO and Procedural
The library offers both OO method chaining with `Stringy\Stringy`, as well as
procedural-style static method calls with `Stringy\StaticStringy`. An example
of the former is the following:
```php
use Stringy\Stringy as S;
echo S::create('Fòô Bàř', 'UTF-8')->collapseWhitespace()->swapCase(); // 'fÒÔ bÀŘ'
```
`Stringy\Stringy` has a __toString() method, which returns the current string
when the object is used in a string context, ie:
`(string) S::create('foo') // 'foo'`
Using the static wrapper, an alternative is the following:
```php
use Stringy\StaticStringy as S;
$string = S::collapseWhitespace('Fòô Bàř', 'UTF-8');
echo S::swapCase($string, 'UTF-8'); // 'fÒÔ bÀŘ'
```
## Implemented Interfaces
`Stringy\Stringy` implements the `IteratorAggregate` interface, meaning that
`foreach` can be used with an instance of the class:
``` php
$stringy = S::create('Fòô Bàř', 'UTF-8');
foreach ($stringy as $char) {
echo $char;
}
// 'Fòô Bàř'
```
It implements the `Countable` interface, enabling the use of `count()` to
retrieve the number of characters in the string:
``` php
$stringy = S::create('Fòô', 'UTF-8');
count($stringy); // 3
```
Furthermore, the `ArrayAccess` interface has been implemented. As a result,
`isset()` can be used to check if a character at a specific index exists. And
since `Stringy\Stringy` is immutable, any call to `offsetSet` or `offsetUnset`
will throw an exception. `offsetGet` has been implemented, however, and accepts
both positive and negative indexes. Invalid indexes result in an
`OutOfBoundsException`.
``` php
$stringy = S::create('Bàř', 'UTF-8');
echo $stringy[2]; // 'ř'
echo $stringy[-2]; // 'à'
isset($stringy[-4]); // false
$stringy[3]; // OutOfBoundsException
$stringy[2] = 'a'; // Exception
```
## PHP 5.6 Creation
As of PHP 5.6, [`use function`](https://wiki.php.net/rfc/use_function) is
available for importing functions. Stringy exposes a namespaced function,
`Stringy\create`, which emits the same behaviour as `Stringy\Stringy::create()`.
If running PHP 5.6, or another runtime that supports the `use function` syntax,
you can take advantage of an even simpler API as seen below:
``` php
use function Stringy\create as s;
// Instead of: S::create('Fòô Bàř', 'UTF-8')
s('Fòô Bàř', 'UTF-8')->collapseWhitespace()->swapCase();
```
## Methods
In the list below, any static method other than S::create refers to a method in
`Stringy\StaticStringy`. For all others, they're found in `Stringy\Stringy`.
Furthermore, all methods that return a Stringy object or string do not modify
the original. Stringy objects are immutable.
*Note: If `$encoding` is not given, it defaults to `mb_internal_encoding()`.*
#### at
$stringy->at(int $index)
S::at(int $index [, string $encoding ])
Returns the character at $index, with indexes starting at 0.
```php
S::create('fòô bàř', 'UTF-8')->at(6);
S::at('fòô bàř', 6, 'UTF-8'); // 'ř'
```
#### camelize
$stringy->camelize();
S::camelize(string $str [, string $encoding ])
Returns a camelCase version of the string. Trims surrounding spaces,
capitalizes letters following digits, spaces, dashes and underscores,
and removes spaces, dashes, as well as underscores.
```php
S::create('Camel-Case')->camelize();
S::camelize('Camel-Case'); // 'camelCase'
```
#### chars
$stringy->chars();
S::chars(string $str [, string $encoding ])
Returns an array consisting of the characters in the string.
```php
S::create('Fòô Bàř', 'UTF-8')->chars();
S::chars('Fòô Bàř', 'UTF-8'); // array(F', 'ò', 'ô', ' ', 'B', 'à', 'ř')
```
#### collapseWhitespace
$stringy->collapseWhitespace()
S::collapseWhitespace(string $str [, string $encoding ])
Trims the string and replaces consecutive whitespace characters with a
single space. This includes tabs and newline characters, as well as
multibyte whitespace such as the thin space and ideographic space.
```php
S::create(' Ο συγγραφέας ')->collapseWhitespace();
S::collapseWhitespace(' Ο συγγραφέας '); // 'Ο συγγραφέας'
```
#### contains
$stringy->contains(string $needle [, boolean $caseSensitive = true ])
S::contains(string $haystack, string $needle [, boolean $caseSensitive = true [, string $encoding ]])
Returns true if the string contains $needle, false otherwise. By default,
the comparison is case-sensitive, but can be made insensitive
by setting $caseSensitive to false.
```php
S::create('Ο συγγραφέας �
没有合适的资源?快使用搜索试试~ 我知道了~
独立版企微魔盒企业微信系统V7.5开源版.zip
共2006个文件
php:1062个
html:404个
css:166个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 105 浏览量
2024-05-23
14:51:01
上传
评论
收藏 55.01MB ZIP 举报
温馨提示
1.部分功能适配新版企业微信第三方应用API; 2.解决企业微信第三方API调整后扫码显示企业未入驻,授权第三方企业id不正确的问题; 3.解决企业微信第三方API调整后注册之后登录不成功的问题; 4.优化部分客户创建裂变任务选择员工一直在转圈加载的问题; 5.优化部分客户裂变任务邀请老客户问题以及数据统计页面问题; 6.优化部分客户代理商下级客户红包领取成功但是实际没有到账的问题; 7.优化部分客户裂变任务的红包领取了但是余额不会扣除也没有记录的问题; 8.优化部分客户消息群发选择定时群发选择成员保存后,到时间企业微信端 该员工没有收到消息提醒的问题; 9.优化部分客户解决裂变任务加载奖励类型加载不出来的问题; 10.优化部分客户总后台的预留菜单设置显示后,pc网站还是不显示的问题; 11.优化部分客户创建群裂变任务,扫码关注生成的海报分享,客户扫码海报二维码,关注公众号不推送欢迎语的问题; 12.总后台客户管理新增用户名编辑功能; 13.权限管理插件优化; 14.优化部分客户扫码登录可以全部员工登录; 15.优化部分客户群裂变插件发出的参加活动链接点开显示域名不一致的问题;
资源推荐
资源详情
资源评论
收起资源包目录
独立版企微魔盒企业微信系统V7.5开源版.zip (2006个子文件)
-test 35B
random_compat.phar.pubkey.asc 488B
upgrade-carbon.bat 122B
upgrade-carbon.bat 101B
pimple.c 37KB
common.css 332KB
amazeui.min.css 249KB
style.css 144KB
themes.css 122KB
bootstrap.min.css 122KB
boot.css 122KB
bootstrap_min.css 120KB
bootstrap.min.css 118KB
bootstrap3.3.7.min.css 118KB
bootstrap.min.css 111KB
bootstrap.min.css 111KB
font.css 100KB
weui.min.css 99KB
weui.min.css 99KB
todc_bootstrap.css 90KB
style.css 87KB
animate.css 73KB
layui.css 73KB
layui.css 73KB
layui.css 73KB
layui.css 73KB
layui.css 73KB
layui.css 68KB
style_h.css 65KB
style.min.css 56KB
login.css 53KB
app.css 49KB
member.css 40KB
jquery-ui.min.css 31KB
font-awesome.min.css 30KB
font-awesome.min.css 30KB
index.css 25KB
shop.css 25KB
style.css 24KB
todc_bootstrap_button.css 23KB
bootstrap-theme.min.css 23KB
swiper.min.css 19KB
animate.min.css 19KB
base1.css 19KB
formSelects-v4.css 18KB
formSelects-v4.css 18KB
cusmenu.css 17KB
frame_v3.css 17KB
bootstrap_responsive_min.css 16KB
select2.min.css 15KB
chosen.css 15KB
fullcalendar.min.css 15KB
bootstrap_switch.css 15KB
mission.css 14KB
layer.css 14KB
layer.css 14KB
layer.css 14KB
layer.css 14KB
layer.css 14KB
layer.css 14KB
layer.css 14KB
jquery-ui.theme.min.css 14KB
chosen.min.css 13KB
message-tip.css 13KB
om-apusic.css 13KB
menu-monitor.css 13KB
bootstrap.min.css 13KB
bootstrapSwitch.css 12KB
inside.css 11KB
order.css 10KB
layui.mobile.css 10KB
layui.mobile.css 10KB
uploadify.css 9KB
amazeui.datatables.min.css 9KB
base.css 9KB
base.css 9KB
base.css 8KB
base.css 8KB
blue.css 8KB
blue.css 8KB
laydate.css 7KB
laydate.css 7KB
laydate.css 7KB
laydate.css 7KB
laydate.css 7KB
official.css 7KB
details.css 7KB
design.min.css 7KB
appmsg.css 7KB
design.min.css 6KB
home.css 6KB
manager.css 6KB
manager.css 6KB
44.css 6KB
fullcalendar.print.css 6KB
admin.css 6KB
bootstrap-switch.min.css 5KB
details2.css 5KB
index.css 5KB
login.css 5KB
共 2006 条
- 1
- 2
- 3
- 4
- 5
- 6
- 21
资源评论
智慧浩海
- 粉丝: 1w+
- 资源: 5203
下载权益
C知道特权
VIP文章
课程特权
开通VIP
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 基于python的rpa管理系统 (4).zip
- 基于python的rpa管理系统 (3).zip
- scrollCue.js 一款效果很nice的JavaScript插件,页面滚动时多种动画效果显示页面内容
- 基于python的rpa管理系统 (2).zip
- 基于python的rpa管理系统 .zip
- 全球国家及首都经纬度.xlsx
- 前端js模拟微信截图涂鸦
- prettyZoo-win-v2.1.1.msi (0积分下载,Zookeeper 可视化工具)
- Java健身房会员管理系统案例介绍:管理会员信息、健身课程预约、健身成绩统计等功能
- Java音乐播放器案例介绍:支持音乐文件的播放、管理歌单和收藏等
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功