选择语言 :

Core_Str

字符串处理类

API - Core_Str

author
呼吸二氧化碳 jonwang@myqee.com
category
MyQEE
package
System
subpackage
Core
copyright
Copyright © 2008-2013 myqee.com
license
http://www.myqee.com/license.html

$this->__construct( $data = '')

字符串对象

参数列表

参数 类型 描述 默认值
$data string $data empty

$this->__toString( )


Str::factory( $data = '')

返回实例化对象

参数列表

参数 类型 描述 默认值
$data array $data empty
返回值
  • Str

$this->toString( )

获取字符串


$this->addcslashes( )


$this->substr( $start , $length = null, $encoding = 'UTF-8')

截取字段

参数列表

参数 类型 描述 默认值
$start int $start
$length int $length null
$encoding string $encoding string(5) "UTF-8"

$this->text2html( )

文本转换为HTML 将处理<>和换行符


$this->strlen( $encoding = 'utf-8')

字符串长度

参数列表

参数 类型 描述 默认值
$encoding $encoding 字符编码,默认utf-8 string(5) "utf-8"

$this->count( $encoding = 'utf-8')

字符串长度

参数列表

参数 类型 描述 默认值
$encoding $encoding 字符编码,默认utf-8 string(5) "utf-8"

$this->append( $value )

追加数据

参数列表

参数 类型 描述 默认值
$value string $value

$this->is_empty( )


$this->escape( $encode = 'UTF-8')

等同js脚本里的escape函数

参数列表

参数 类型 描述 默认值
$encode string $str string(5) "UTF-8"

$this->unescape( $encode = 'UTF-8')

等同js脚本里的unescape函数

参数列表

参数 类型 描述 默认值
$encode string $encode string(5) "UTF-8"

$this->pinyin( )

返回当前字符的拼音

返回值
  • string

$this->byte( $force_unit = null, $format = null, $si = true)

输出字节格式化

参数列表

参数 类型 描述 默认值
$force_unit string A definitive unit null
$format string The return string format null
$si boolean Whether to use SI prefixes or IEC bool true
返回值
  • string