Textpattern PHP Cross Reference Content Management Systems

Summary: /textpattern/vendors/Textpattern/Type/StringType.php - 492 lines - 11708 bytes - Source - Print

Description: StringType object.

Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

StringType:: (21 methods):
__construct()
__toString()
getString()
getLength()
position()
count()
toCallback()
addSlashes()
html()
substring()
replace()
tr()
trim()
ltrim()
rtrim()
chunk()
wordWrap()
lower()
upper()
title()
ucfirst()

Class: StringType


__construct($string line: 74
Constructor.

param: string $string The string
__toString()  line: 93
Gets the string.

<code>
echo (string) Txp::get('\Textpattern\Type\StringType', 'Hello World!');
</code>

return: string
getString()  line: 109
Gets the string.

<code>
echo Txp::get('\Textpattern\Type\StringType', 'Hello World!')->getString();
</code>

return: string
getLength()  line: 125
Gets string length.

<code>
echo Txp::get('\Textpattern\Type\StringType', 'Hello World!')->getLength();
</code>

return: int
position($needle, $offset = 0)  line: 148
Finds the first occurrence of a string in the string.

<code>
echo Txp::get('\Textpattern\Type\StringType', '#@language')->position('@');
</code>

return: int|bool FALSE if the string does not contain results
param: string $needle The string to find
param: int    $offset The search offset
count($needle line: 169
Gets substring count.

<code>
echo Txp::get('\Textpattern\Type\StringType', 'Hello World!')->count('ello');
</code>

return: int
param: string $needle The string to find
toCallback()  line: 189
Converts the string to a callback.

<code>
Txp::get('\Textpattern\Type\StringType', '\Textpattern\Password\Hash->hash')->toCallback();
</code>

return: mixed Callable
addSlashes()  line: 216
Add slashes.

<code>
echo (string) Txp::get('\Textpattern\Type\StringType', 'Some "content" to slash.')->addSlashes();
</code>

return: StringType
html($flags = ENT_QUOTES, $double_encode = true)  line: 233
HTML encodes the string.

<code>
echo (string) Txp::get('\Textpattern\Type\StringType', '<strong>Hello World!</strong>')->html();
</code>

return: StringType
param: int  $flags         A bitmask of one or more flags. The default is ENT_QUOTES
param: bool $double_encode When double_encode is turned off PHP will not encode existing HTML entities, the default is to convert everything
substring($start, $length = null)  line: 252
Splits part of the string.

<code>
echo (string) Txp::get('\Textpattern\Type\StringType', 'Hello World!')->substring(2, 5);
</code>

return: StringType
param: int $start  The start
param: int $length The length
replace($from, $to line: 275
Replaces all occurrences with replacements.

<code>
echo (string) Txp::get('\Textpattern\Type\StringType', 'Hello World!')->replace('!', '.');
</code>

return: StringType
param: mixed $from The needle to find
param: mixed $to   The replacement
tr($from, $to = null)  line: 294
Translates substrings.

<code>
echo (string) Txp::get('\Textpattern\Type\StringType', 'Article <strong>{title}</strong> deleted.')
->tr('{title}', 'Hello {title} variable.');
</code>

return: StringType
param: string $from StringType to find
param: string $to   The replacement
trim($characters = "\t\n\r\0\x0B")  line: 314
Trims surrounding whitespace or other characters.

<code>
echo (string) Txp::get('\Textpattern\Type\StringType', ' Hello World! ')->trim();
</code>

return: StringType
param: string $characters Character list
ltrim($characters = "\t\n\r\0\x0B")  line: 332
Trims whitespace or other characters from the beginning.

<code>
echo (string) Txp::get('\Textpattern\Type\StringType', ' Hello World! ')->ltrim();
</code>

return: StringType
param: string $characters Character list
rtrim($characters = "\t\n\r\0\x0B")  line: 350
Trims whitespace or other characters from the end.

<code>
echo (string) Txp::get('\Textpattern\Type\StringType', ' Hello World! ')->rtrim();
</code>

return: StringType
param: string $characters Character list
chunk($length = 76, $delimiter = n)  line: 368
Splits string to chunks.

<code>
echo (string) Txp::get('\Textpattern\Type\StringType', 'Hello World!')->chunk(1);
</code>

return: StringType
param: int    $length    The chunk length
param: string $delimiter The delimiter
wordWrap($length = 75, $delimiter = n, $cut = false)  line: 387
Word wraps the string.

<code>
echo (string) Txp::get('\Textpattern\Type\StringType', 'Hello World!')->wordWrap();
</code>

return: StringType
param: int    $length    The line length
param: string $delimiter The line delimiter
param: bool   $cut       Cut off words
lower()  line: 407
Converts the string to lowercase.

<code>
echo (string) Txp::get('\Textpattern\Type\StringType', 'Hello World!')->lower();
</code>

return: StringType
upper()  line: 428
Converts the string to uppercase.

<code>
echo (string) Txp::get('\Textpattern\Type\StringType', 'Hello World!')->upper();
</code>

return: StringType
title()  line: 449
Converts the string to titlecase.

<code>
echo (string) Txp::get('\Textpattern\Type\StringType', 'hello world!')->title();
</code>

return: StringType
ucfirst()  line: 470
Uppercase the first letter.

<code>
echo (string) Txp::get('\Textpattern\Type\StringType', 'Hello World!')->ucfirst();
</code>

return: StringType

title

Body