Class String
A String object stores a native PHP string and implements an advanced interface. Strings are per default immutable. For a mutable String object, see String\Mutable.
Strings operations are based on an associated character set, which defaults
to the currently active character set during creating of the Core\String
object. Therefore if String instances are equal but differ in their
character set, their hash values do not match.
PHP 7 Compatibility Issues
Due to backward-incompatible changes in PHP 7, string
and other native
type names will be reserved keywords. This class will have to be renamed
for PHP 7 compatibility.
- Core\Object implements Core\Chainable
- Core\Set implements Core\Accessor
- Core\String implements ArrayAccess, Core\Comparable, Core\Equality, Iterator, Core\Masquerade
Direct known subclasses
Package: Core\String
See: String\Mutable
Since: 3.0
Requires: PHP 5.3
Version: 1.0
Located at String.inc.php
Methods summary
public
|
|
public
string
|
|
public
integer
|
|
public
|
#
convertTo(
Returns a String instance representing the same Unicode string with a different character set. |
public
string
|
|
public
string
|
#
hash( )
Returns a hash value based on the actual string. The calculated hash value is based on the binary String and the associated character set. |
public
boolean
|
#
isEqualTo( $value )
Tests, whether the current String is equal to another value or object. Two String instances are equal if and only if they are based on the same character set and their string buffers are binary equal. |
public
integer
|
|
public static
|
|
public
|
|
public
boolean
|
|
public
string
|
|
public
|
#
offsetSet( integer $index, string $value )
Not available for immutable String instances; raises an exception. |
public
|
|
public
|
|
public
string[]
|
|
public static
string[]
|
#
splitSettingListStr( string $string )
Returns an array of list elements extracted from the given string. |
public
string
|
|
public
boolean
|
Methods inherited from Core\Object
__autocreateFactory()
,
__call()
,
__processParameters()
,
attachMethod()
,
chain()
,
getValueForKey()
,
getValueForKeyPath()
,
getValueForUndefinedKey()
,
issetValueForKey()
,
setValueForKey()
,
setValueForKeyPath()
,
setValueForUndefinedKey()
,
uuid()
Constants summary
Constants inherited from Core\Object
AnyParameterType
,
AutochainParameterType
,
AutocreateParameterType
,
BooleanParameterType
,
CharParameterType
,
EnumParameterType
,
IntegerParameterType
,
RealParameterType
,
StringParameterType
,
UserParameterType
Properties summary
protected
string
|
$_v_binaryString
The original, binary string used to initialise the instance. |
|
protected
|
$_v_charset
The character set instance. Defaults to the currently active character set during initialisation. |
|
protected
integer
|
$_v_length
Buffered string length value in characters (not bytes). |
|
protected
string
|
$_hash
Hash. |
|
protected
integer
|
$_position
Iterator position. |
Magic properties
public read-only
string
|
$binaryString
Internal binary string representation. |
public read-only
|
$charset
Character set of the internal binary string. |
public read-only
string
|
$hash
Hash based on binary string and character set. |
public read-only
integer
|
$length
Length of the string in characters (not bytes). |