direktori cari
Array Array Helper Benchmarking Benchmarking Class Caching Caching Driver Calendaring Calendaring Class CAPTCHA CAPTCHA Helper Config Config Class Cookie Cookie Helper Database Connecting to your Database Custom Function Calls Database Caching Class Database Configuration Database Forge Class Database Metadata Database Quick Start: Example Code Database Reference Database Utility Class DB Driver Reference Generating Query Results Queries Query Builder Class Query Helper Methods Transactions Date Date Helper Directory Directory Helper Download Download Helper Email Email Class Email Helper Encrypt Encrypt Class Encryption Encryption Library File File Helper File Uploading File Uploading Class Form Form Helper Form Validation Form Validation FTP FTP Class Functions compatibility_functions common_functions HTML HTML Helper HTML Table HTML Table Class Image Manipulation Image Manipulation Class Inflector Inflector Helper Input Input Class Javascript Javascript Class Language Language Class Language Helper Loader Loader Class Migrations Migrations Class Number Number Helper Output Output Class Pagination Pagination Class Path Path Helper Security Security Class Security Helper Session Session Library Shopping Cart Shopping Cart Class Smiley Smiley Helper String String Helper Template Parser Template Parser Class Text Text Helper Trackback Trackback Class Typography Typography Class Typography Helper Unit Testing Unit Testing Class URI URL User Agent XML XML-RPC and XML-RPC Server Zip Encoding Zip Encoding Class XML-RPC and XML-RPC Server Classes XML Helper User Agent Class URL Helper URI Class
watak

Inflector Helper文件包含允许您将英语单词更改为复数,单数,驼峰等的功能。

  • 加载此助手

  • 可用职能

加载此助手

使用以下代码加载此助手:

$this->load->helper('inflector');

可用职能

现有下列职能:

singular($str)

参数:

$ str(string) - 输入字符串

返回:

一个单词

返回类型:

  • $ strstring) - 输入字符串返回:单数字返回类型:字符串将复数单词更改为单数。例如:echo singular('dogs'); //打印'dog' plural($str)参数:$ str(string) - 输入stringReturns:复数字返回类型:字符串

  • $ strstring) - 输入字符串

Returns:  A plural word
Return type:  string
将单数词改为复数。例:

echo plural('dog'); // Prints 'dogs'

camelize($str)

参数:

$ str(string) - 输入字符串

返回:

Camelized字符串

返回类型:

  • $ strstring) - 输入字符串返回:驼峰字符串返回类型:字符串将由空格或下划线分隔的字符串更改为驼峰大小写。例如:echo camelize('my_dog_spot'); //打印'myDogSpot' underscore($str)参数:$ str(string) - 输入stringReturns:包含下划线而不是空格的字符串返回类型:字符串

  • $ strstring) - 输入字符串

Returns:  String containing underscores instead of spaces
Return type:  string
用空格分隔多个单词并强调它们。例:

echo underscore('my dog spot'); // Prints 'my_dog_spot'

humanize($str[, $separator = '_'])

参数:

$ str(string) - 输入字符串$ separator(string) - 输入分隔符

返回:

人性化的字符串

返回类型:

  • $ strstring) - 输入字符串

  • $ separatorstring) - 输入分隔符

Returns:  Humanized string
Return type:  string
用多个单词分隔下划线并在它们之间添加空格。每个单词都是大写的。

例子:

echo humanize('my_dog_spot'); // Prints 'My Dog Spot'

使用破折号代替下划线:

echo humanize('my-dog-spot', '-'); // Prints 'My Dog Spot'

is_countable($word)

参数:

$ word(string) - 输入字符串

返回:

如果该单词是可数的,则为TRUE;否则为TRUE

返回类型:

布尔

  • $ wordstring) - 输入字符串

返回:如果单词是可数的,则返回TRUE;否则返回FALSE
Return type:  bool
检查给定的单词是否有复数形式。例:

is_countable( '设备'); //返回FALSE

Artikel sebelumnya: Artikel seterusnya: