public
|
#
__construct( $string, $charset = null )
Initialises a new String instance.
Initialises a new String instance.
Parameters
- $string
- string or String instance to initialise String object with.
- $charset
set instance or name of character set to use. Defaults to
the currently active character set.
Throws
Since
3.0
|
public
string
|
#
__toString( )
Returns the native representation of the string.
Returns the native representation of the string.
Returns
string The content of the binary string buffer.
Since
3,0
Overrides
|
public
String
|
#
camelCase( string $chars = null )
Transforms the string into camelcase.
Transforms the string into camelcase.
Parameters
- $chars
String of separator characters used in source string. These characters
are removed from the source string and the immediately following
character is transformed to its uppercase equivalent. Default to "_-" .
Returns
String New string instance with camelcase variant of source string.
Since
3.2
|
public static
string
|
#
camelCaseStr( string $string, string $chars = null )
Transforms a given string into camelcase.
Transforms a given string into camelcase.
Parameters
- $string
- String to transform.
- $chars
String of separator characters used in source string. These characters
are removed from the source string and the immediately following
character is transformed to its uppercase equivalent. Default to "_-" .
Returns
string Camelcase variant of source string.
Since
3.2
|
public
integer
|
#
compareTo( $value )
Compares the current string with another value or object.
Compares the current string with another value or object.
Comparison might not work as expected for character sets that do not
represent their characters in binary order.
Parameters
- $value
to compare current String with. If the provided value is not
a String instance, it is converted to a String object using the
currently active character set and compared afterwards.
Returns
integer Returns < 0 if the current String is less than the argument; > 0 if the
current String is greater than the parameter object, and 0 if both are
equal.
Strings are compared by their represented data and not the actual
representation; therefore two String instances compare equal if both
represent the same Unicode string even though both instances are based
on different character sets.
Since
3.0
Implementation of
|
public
String
|
#
convertTo( Core\Charset |string $charsetNameOrObject )
Returns a String instance representing the same Unicode string with a
different character set.
Returns a String instance representing the same Unicode string with a
different character set.
Parameters
- $charsetNameOrObject
- Character set instance or name of converted result.
Returns
String New string instance with a different character set than the current
String instance or the current instance, if the character sets match.
Since
3.0
|
public
string
|
#
current( )
Returns the current character string (used by iterators).
Returns the current character string (used by iterators).
Returns
string Current character string.
Since
3.0
Implementation of
|
public
String
|
#
deCamelCase( string $character )
Reverts a camelcase transformation.
Reverts a camelcase transformation.
Parameters
- $character
Single character or string to insert between words that start
with an uppercase letter. The uppercase letter is transformed
to lowercase.
Returns
String New string instance with non-camelcase variant of source string.
Since
3.2
|
public static
string
|
#
deCamelCaseStr( string $string, string $character )
Reverts a camelcase transformation.
Reverts a camelcase transformation.
Parameters
- $string
- String in camelcase format to transform.
- $character
Single character or string to insert between words that start
with an uppercase letter. The uppercase letter is transformed
to lowercase.
Returns
string Non-camelcase variant of source string.
Since
3.2
|
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.
Returns a hash value based on the actual string. The calculated hash
value is based on the binary String and the associated character set.
Returns
string Hash value of the object.
Since
3.0
Overrides
|
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.
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.
If the provided argument is not a String instance, it is converted to
a String if the currently active character set is equal to the
character set used by the current String prior to testing for equality;
if the character sets do not match, false is returned.
To test for equality based on the represented Unicode string, use the
compareTo() method:
if (0 == $s1->compareTo($s2)) {
}
To test for binary string buffer equality, use the following code:
if ($s->binaryString == $someBinaryString) {
}
Parameters
- $value
or object to test for equality with the current String. If the
provided value is not a String instance, the value is automatically
converted to a String before testing for equality.
Returns
boolean Returns true , if the provided value and the current String are
equal, otherwise false .
Since
3.0
Implementation of
|
public
integer
|
#
key( )
Returns the index of the current character pointer (used by iterators).
Returns the index of the current character pointer (used by iterators).
Returns
integer Current index of character pointer.
Since
3.0
Implementation of
|
public static
String
|
#
mask( $value )
Returns a new String instance from the provided value.
Returns a new String instance from the provided value.
This method uses late static binding to retrieve the name of the class
called to initialise a new String-based instance. Subclasses in general
are not required to re-implement this method.
Parameters
- $value
- to embed in String instance.
Returns
String New String instance from the specified value.
Throws
Since
3.1
Implementation of
|
public
|
#
next( )
Sets the internal pointer on the next character (used by iterators).
Sets the internal pointer on the next character (used by iterators).
Since
3.0
Implementation of
|
public
boolean
|
#
offsetExists( $index )
Tests, whether a character string index is in the allowed range.
Tests, whether a character string index is in the allowed range.
Parameters
- $index
- index of desired character string of the String object.
Returns
boolean
true , if the index is in the allowed range, otherwise false .
Since
3.0
Implementation of
|
public
string
|
#
offsetGet( $index )
Returns the character string at the given position.
Returns the character string at the given position.
Parameters
- $index
- index of desired character string of the String object.
Returns
string Character string at the desired index.
Throws
Since
3.0
Implementation of
|
public
|
#
offsetSet( integer $index, string $value )
Not available for immutable String instances; raises an exception.
Not available for immutable String instances; raises an exception.
Parameters
Throws
Since
3.0
Implementation of
|
public
|
#
offsetUnset( integer $index )
Not available for immutable String instances; raises an exception.
Not available for immutable String instances; raises an exception.
Parameters
Throws
Since
3.0
Implementation of
|
public
|
#
rewind( )
Resets the internal pointer to the first character (used by iterators).
Resets the internal pointer to the first character (used by iterators).
Since
3.0
Implementation of
|
public
string[]
|
#
splitSettingList( )
Returns an array of list elements extracted from the current string.
Returns an array of list elements extracted from the current string.
A simple list is a string of list entries separated by a space, semicolon,
comma, control character or NUL . Empty entries are ignored.
The internal binary string is processed, hence the returned array
stores fragments encoded in the internal character set.
Returns
string[] Array of list elements.
Since
3.1
|
public static
string[]
|
#
splitSettingListStr( string $string )
Returns an array of list elements extracted from the given string.
Returns an array of list elements extracted from the given string.
A simple list is a string of list entries separated by a space, semicolon,
comma, control character or NUL . Empty entries are ignored.
Parameters
Returns
string[] Array of list elements.
Since
3.1
|
public
string
|
#
unmask( )
Returns the internal binary string.
Returns the internal binary string.
Subclasses that store the internal string value in a modified form, e.g.
encrypted, must return the original string data.
Returns
string Binary string stored by this String instance.
Since
3.1
Implementation of
|
public
boolean
|
#
valid( )
Tests, whether the current iteration value is valid (used by iterators).
Tests, whether the current iteration value is valid (used by iterators).
Returns
boolean
true , if the current value is valid, otherwise false .
Since
3.0
Implementation of
|