YANA 4 PHP Framework
Docs For Class String_type
«datatype» String_type
This is an OO-wrapper for the scalar string type of PHP. This implementation is compatible with PHP 4 and 5.
Note: this class is still under developement. You may use it already, but you should be aware of possible changes in the future.
Located in /includes/class_string_type.php
SerializeableObject | --String_type
Name | Type | Description |
---|---|---|
$stringValue | string |
Creates a new string wrapper. The input must be convertable to a string value.
Name | Type | Description |
---|---|---|
$charlist | string | (optional) |
Name | Type | Description |
---|---|---|
$index | int | (optional) |
Returns bool(false) on error. Issues an E_USER_ERROR if $index is of wrong type. Issues an E_USER_NOTICE if $index is out of bounds.
Note that indices are numbered starting with '0'.
Name | Type | Description |
---|---|---|
$anotherString | string |
Returns
Note: This function is case-sensitive.
Name | Type | Description |
---|---|---|
$anotherString | string |
Returns
Note: This function is NOT case-sensitive.
creates a copy of this object
Redefinition of: SerializeableObject::copy()
Name | Type | Description |
---|---|---|
$encoding | string | |
$style | int | (optional) |
$charset | string | (optional) |
Note: charset applies only to encoding = "entities"
This function is the opposite of "encode()". See "encode()" for details on the available types of encoding.
Name | Type | Description |
---|---|---|
$encoding | string | see the list of valid inputs for details |
$style | string | (optional) |
$charset | string | (optional) |
Note: charset applies only to encoding = "entities"
Returns an encoded version depending on the type of encoding you choose.
The input value is not case-sensitive.
Note: The results of this function can be reversed using the "decode()" function with the same values. If you are looking for checksums and hashing-methods see the "encrypt" function.
The following values are available.
Name | Type | Description |
---|---|---|
$encryption | string | (optional) see the list of valid inputs for details |
$salt | string | (optional) only used for certain encryption types |
Returns an encrypted version depending on the type of encryption you choose.
The input value is not case-sensitive.
Note: The result of this function is alwas irreversible. If you are looking for reversible encryption methods see the "encode" function.
The following values are available.
This method issues an E_USER_NOTICE and returns the integer constant STRING_UNSUPPORTED_ENCRYPTION if the $encryption parameter has an invalid value.
Name | Type | Description |
---|---|---|
$something | mixed |
Returns
Note: this is unlike the PHP code ($string == $something) where you might accidently run into comparision in e.g. a boolean context.
Redefinition of: SerializeableObject::equals()
Unboxing the object. This function returns the scalar string value of the object.
Name | Type | Description |
---|---|---|
$input | string |
Name | Type | Description |
---|---|---|
$needle | string | |
$offset | int | (optional) |
Returns character-offset of first occurence of $needle within this string. Indices starting with int(0).
Returns Java-style int(-1) if $needle is not found, NOT Php-style bool(false). This is because int(0) and bool(false) might get mixed by accident.
So while if
will return true, even if $needle is not found, the test
- (strpos($string, $needle) == 0))
will return false if $needle is not found and true if and only if $string starts with the string $needle.
- if ($string->indexOf($needle) == 0)
Name | Type | Description |
---|---|---|
$regularExpression | string |
Matches this string against a given Perl-compatible regular expression. Returns an array containing the FIRST set of matches or bool(false) if the regular expression did not match at all.
Name | Type | Description |
---|---|---|
$regularExpression | string |
Matches this string against a given Perl-compatible regular expression. Returns an array containing ALL the matches or bool(false) if the regular expression did not match at all.
Name | Type | Description |
---|---|---|
$charlist | string | (optional) |
Name | Type | Description |
---|---|---|
$needle | string | |
$substitute | string | (optional) |
Name | Type | Description |
---|---|---|
$needle | string | |
$substitute | string | (optional) |
$limit | int | (optional) must be a positive integer > 0, defaults to -1 (no limit) |
Name | Type | Description |
---|---|---|
$new_value | string |
Assigns a new value to the object. Returns the old value.
Name | Type | Description |
---|---|---|
$separator | string | |
$limit | int | (optional) |
Name | Type | Description |
---|---|---|
$separator | string | |
$limit | int | (optional) |
Name | Type | Description |
---|---|---|
$start | int | |
$length | int | (optional) |
Returns a substring beginning at character-offset $start with $length characters. See PHP-Manual "string functions" "substr()" for details.
Returns a boolean value depending on the value of the string.
Note: If you just want to check wether a string is empty or not, use $string->equals("") instead.
Converts the string value to a float and returns it. Returns bool(false) if the string is not numeric.
Converts the string value to an integer and returns it. Returns bool(false) if the string is not numeric.
Redefinition of: SerializeableObject::toString()
Name | Type | Description |
---|---|---|
$width | int | (optional) |
$break | string | (optional) |
$cut | bool | (optional) |
Note: THIS FUNCTION IS NOT BINARY-SAFE!
Inherited From SerializeableObject
Documentation generated on Fri, 10 Nov 2006 00:35:42 +0100 by phpDocumentor 1.3.0RC4