定制 weew/helpers-string 二次开发

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

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

weew/helpers-string

最新稳定版本:v1.10.0

Composer 安装命令:

composer require weew/helpers-string

包简介

Collection of useful php string helpers.

README 文档

README

Build Status Test Coverage Version Licence

Table of contents

Installation

composer install weew/helpers-string

Introduction

This tiny library provides various helper functions to deal with common string manipulation related problems.

Functions

s

Simple helper to format strings. Supports placeholders like :key and %s.

string s(string $format, mixed $args [, mixed $...])

str_starts_with

Check if a string starts with the given sequence.

bool str_starts_with(string $string, string $search [, bool $caseSensitive = false])

str_ends_with

heck if a string ends with the given sequence.

bool str_ends_with(string $string, string $search [, bool $caseSensitive = false])

url

Combine multiple strings to a url. This function makes sure the pieces are properly glued together with a / and eliminates all //, except after the protocol.

string url(string $paths [, $...])

path

Combine multiple strings to a path. Glues pieces together with the proper directory separator and eliminates all // or \\.

string path(string $paths [, $...])

get_type

Get type of a value. Returns values like int, string, function. Objects will return its class name.

string get_type(mixed $abstract)

str_snake_case

Convert string to snake_case.

string str_snake_case(string $string)

str_studly_caps

Convert string to StudlyCase.

string str_studly_caps(string $string [, array $delimiters = ['-', '_']])

str_camel_case

Convert a string to camelCase.

string str_camel_case(string $string [, array $delimiters = ['-', '_']])

str_random

Generate a random alphanumeric string. Works only with even numbers.

string str_random([int $length = 10])

str_explode

Split a string by one or multiple delimiters. Works the same way as the explode function, but allows several delimiters.

string str_explode(string $string, string|array $delimiter [, int $limit = PHP_INT_MAX])

uuid

Generate a v4 uuid.

string uuid([string $prefix = null, int $length = 36])

uuid_format

Format string as a v4 uuid.

string uuid_format(string $string [, string $prefix = null, int $length = null])

simple_uuid

Generate a uuid of a simpler format.

string simple_uuid()

format_xml

Format an xml string.

string format_xml($string)

统计信息

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

GitHub 信息

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

其他信息

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