yana

Description
  Class trees
  Index of elements
  Todo List
core
  Classes
    FormCreator
    Index
    Language
    Object
    Plugin
    PluginManager
    Singleton
    SmartTemplate
    SmartView
    Utility
    Yana
database
  Classes
    DbBlob
    DbCreator
    DbDesigner4
    DbExtractor
    DbQuery
    DbQueryParser
    DbServer
    DbStream
    DbStructure
    FileDb
error_reporting
  Classes
    Alert
    Error
    ErrorUtility
    Log
    Message
    Report
    Warning
file_system
  Classes
    DatFile
    Dir
    Executeable
    File
    FileReadonly
    FileSystemResource
    SML
javascript
  Classes
    AjaxRequest
  Functions
    preview
    yanaAddEventListener
    yanaAddIcon
    yanaCheckEmbTags
    yanaCloseAll
    yanaGetCookie
    yanaGetElementsByClassName
    yanaMaxLength
    yanaMenu
    yanaMenuCookie
    yanaSetCookie
mail
  Classes
    FormMailer
    Mailer
plugins
  Classes
    plugin_blog
    plugin_check
    plugin_db_admin
    plugin_db_tools
    plugin_default_library
    plugin_diagnostics
    plugin_guestbook
    plugin_guestbook_admin
    plugin_ipblock
    plugin_ipblock_admin
    plugin_rss
    plugin_rss_admin
    plugin_sdk
    plugin_search
    plugin_search_admin
    plugin_user
    plugin_user_admin
utilities
  Classes
    Brush
    Counter
    Hashtable
    Image
    Microsummary
    RSS
    RSSitem
    String
  Functions
    checkArgumentList
    cloneArray
    dirlist
    qSearchArray
    untaintInput
    XMLencode
vdrive
  Classes
    Registry
    VDrive
zip
  Classes
    PclZip

phpDocumentor v 1.4.0

YANA Framework for PHPDocs For Class String

### Class String

#### Description

«datatype» String
This is an OO-wrapper for the scalar string type of PHP. This implementation is compatible with PHP 4 and 5.

- access: public
- name: String

    Object
       |
       --String

##### Method Summary

- String String (string $value)
- string &addSlashes ([string $charlist = ""])
- void charAt (int $index)
- String cloneObject ()
- int(+1)|int(0)|int(-1) compareTo (string $anotherString)
- int(+1)|int(0)|int(-1) compareToIgnoreCase (string $anotherString)
- String copy ()
- string &decode (string $encoding, [int $style = ENT_COMPAT], [string $charset = ""])
- string encode (string $encoding, [string $style = ENT_COMPAT], [string $charset = ""])
- string &encrypt ([string $encryption = "md5"], [string $salt = ""])
- bool equals (mixed $something)
- string get ()
- string htmlEntities (string $input)
- string htmlSpecialChars (string $string, [int $quoteStyle = ENT_COMPAT], [string $charset = 'ISO-8859-1'], [bool $doubleEncode = true])
- int indexOf (string $needle, int $offset)
- int length ()
- array|bool(false) match (string $regularExpression)
- array|bool(false) matchAll (string $regularExpression)
- string &removeSlashes (string $charlist)
- int replace (string $needle, [string $substitute = ""])
- int replaceRegExp (string $regularExpression, [string $substitute = ""], [int $limit = -1])
- string &reverse ()
- string set (string $value)
- string &shuffle ()
- array split (string $separator, int $limit)
- array splitRegExp (string $separator, int $limit)
- string &substring (int $start, int $length)
- bool toBool ()
- float|bool(false) toFloat ()
- int|bool(false) toInt ()
- string &toLowerCase ()
- void toString ()
- string &toUpperCase ()
- string &trim ()
- string &wrap (int $width, [string $break = ""], [bool $cut = false])

#### Methods

##### create new instance

String String (
string $value
)

###### List of parameters:

Name | Type | Description
--- | --- | ---
$value | string |

###### Description:

Creates a new string wrapper. The input must be convertable to a string value.

- name: String::__construct()

##### OO-Alias of: addslashes(), addcslashes()

string &addSlashes (
[string $charlist = ""]
)

###### List of parameters:

Name | Type | Description
--- | --- | ---
$charlist | string | a string of characters that should be escaped

###### Description:

- access: public
- name: String::addSlashes()

##### OO-Alias of: $string[$index]

void charAt (
int $index
)

###### List of parameters:

Name | Type | Description
--- | --- | ---
$index | int | position of the character (starting with 0)

###### Description:

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'.

- access: public
- name: String::charAt()

##### clone the string

String cloneObject ()

###### Description:

creates a copy of this object

- access: public
- name: String::cloneObject()

Redefinition of: Object::cloneObject()

##### compare two strings

int(+1)|int(0)|int(-1) compareTo (
string $anotherString
)

###### List of parameters:

Name | Type | Description
--- | --- | ---
$anotherString | string | some other string

###### Description:

Returns

- int(-1) if this string < $anotherString
- int(+0) if this string === $anotherString
- int(+1) if this string > $anotherString

Note: This function is case-sensitive.

- see: String::compareToIgnoreCase()
- access: public
- name: String::compareTo()

##### compare two strings (ignore case)

int(+1)|int(0)|int(-1) compareToIgnoreCase (
string $anotherString
)

###### List of parameters:

Name | Type | Description
--- | --- | ---
$anotherString | string | some other string

###### Description:

Returns

- int(-1) if this string < $anotherString
- int(+0) if this string === $anotherString
- int(+1) if this string > $anotherString

Note: This function is NOT case-sensitive.

- see: String::compareTo()
- access: public
- name: String::compareToIgnoreCase()

##### alias of cloneObject()

String copy ()

###### Description:

- access: public
- name: String::copy()

##### decode a string (revertable)

string &decode (
string $encoding, [int $style = ENT_COMPAT], [string $charset = ""]
)

###### List of parameters:

Name | Type | Description
--- | --- | ---
$encoding | string |
$style | int | (optional)
$charset | string | (optional)

###### Description:

Note: charset applies only to encoding = "entities"
This function is the opposite of "encode()". See "encode()" for details on the available types of encoding.

- see: String::encode()
- see: String::encrypt()
- access: public
- name: String::decode()

##### encoding, or converting a string (revertable)

string encode (
string $encoding, [string $style = ENT_COMPAT], [string $charset = ""]
)

###### List of parameters:

Name | Type | Description
--- | --- | ---
$encoding | string | see the list of valid inputs for details
$style | string | used for entity conversion
$charset | string | used for entity conversion

###### Description:

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.

- unicode: uses utf8_encode(), aliases: "utf", "utf8"
- base64: uses base64_encode()
- url: uses urlencode()
- rawurl: uses rawurlencode()
- entities: uses htmlentities(), uses $style argument
- rot13: does a ROT13 transformation
- quote: quotes meta signs using quotemeta()
- regexp: uses preg_quote(), alias: "regular expression"

- see: String::decode()
- see: String::encrypt()
- access: public
- name: String::encode()

##### hashing function, encryption, transformation (not revertable)

string &encrypt (
[string $encryption = "md5"], [string $salt = ""]
)

###### List of parameters:

Name | Type | Description
--- | --- | ---
$encryption | string | see the list of valid inputs for details
$salt | string | only used for certain encryption types

###### Description:

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.

- crc32: computes the crc32 checksum value of the string
- md5: computes the md5 hash-string (128Bit)
- sha1: computes the sha1 hash-string (160Bit)
- crypt: uses crypt() function, result depending on $salt. See PHP-Manual for details.
- des: uses DES encryption algorithm
- blowfish: uses BLOWFISH encryption algorithm
- soundex: calculates the soundex hash: While this is not an encryption algorithm, it is listed here, because it is uses some sort of irreversible hashing and thus won't fit to encoding()
- metaphone:calculates the metaphone hash: While this is not an encryption algorithm, it is listed here, for the same reason as "soundex". Note: uses the argument $salt as second argument for metaphone() if $salt is a numeric value, that can be converted to int.
- any of the encryption types supported by the PHP "hash()" function introduced as of PHP 5.1.2
- xor: XOR is a simple revertable block chiffre. Use $salt string as password to encrypt the clear text. Call encrypt() with the same arguments again to revert the ciphered text back to clear text. Note that the security of XOR and all other simple block chiffres depend on the length and security off your password. To be really secure your password needs to be minimum as long as the clear text, which is not always praticable.

This method issues an E_USER_NOTICE and returns the integer constant STRING_UNSUPPORTED_ENCRYPTION if the $encryption parameter has an invalid value.

- see: String::encode()
- access: public
- name: String::encrypt()

##### test two strings for equality

bool equals (
mixed $something
)

###### List of parameters:

Name | Type | Description
--- | --- | ---
$something | mixed | some object that should be compared

###### Description:

Returns

- bool(true) if and only if the input is of type string and string representation of the value of this object and the input string are the same, or the input is an object of the same type and the string values of both are equal
- bool(false) otherwise

Note: this is unlike the PHP code ($string == $something) where you might accidently run into comparision in e.g. a boolean context.

- access: public
- name: String::equals()

Redefinition of: Object::equals()

##### get string value

string get ()

###### Description:

Unboxing the object. This function returns the scalar string value of the object.

- access: public
- name: String::get()

##### convert to html entities

string htmlEntities (
string $input
)

###### List of parameters:

Name | Type | Description
--- | --- | ---
$input | string | some string

###### Description:

- see: String::encode()
- access: public
- name: String::htmlEntities()

##### convert html special characters

string htmlSpecialChars (
string $string, [int $quoteStyle = ENT_COMPAT], [string $charset = 'ISO-8859-1'], [bool $doubleEncode = true]
)

###### List of parameters:

Name | Type | Description
--- | --- | ---
$string | string | text to encode
$quoteStyle | int | ENT_COMPAT, ENT_QUOTES, ENT_NOQUOTES
$charset | string | e.g. UTF-8 or ISO-8859-1
$doubleEncode | bool | set to true to avoid double encoded string

###### Description:

This function is much like the original htmlspecialchars() function, but it enables you to use the argument $doubleEncode, which was introduced in PHP 5.2.3 even when running on PHP 4.
If $doubleEncode is set to false, the function will not encode existing HTML entities. In PHP 5.2.3 and beyound the original function is used. In any previous version, that does not have this parameter, the behavior is emulated.

- since: 2.9.6
- access: public

##### get position of first occurence of a needle inside the string

int indexOf (
string $needle, int $offset
)

###### List of parameters:

Name | Type | Description
--- | --- | ---
$needle | string |
$offset | int |

###### Description:

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

1. (strpos($string, $needle) == 0))

will return true, even if $needle is not found, the test

1. if ($string->indexOf($needle) == 0)

will return false if $needle is not found and true if and only if $string starts with the string $needle.

- access: public
- name: String::indexOf()

##### get the length of the string

int length ()

###### Description:

Returns the number of characters in the string.

- access: public
- name: String::length()

##### match string against regular expression

array|bool(false) match (
string $regularExpression
)

###### List of parameters:

Name | Type | Description
--- | --- | ---
$regularExpression | string |

###### Description:

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.

- see: String::matchAll()
- access: public
- name: String::match()

##### match string against regular expression (return all results)

array|bool(false) matchAll (
string $regularExpression
)

###### List of parameters:

Name | Type | Description
--- | --- | ---
$regularExpression | string |

###### Description:

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.

- see: String::match()
- access: public
- name: String::matchAll()

##### OO-Alias of: stripslashes(), stripcslashes()

string &removeSlashes (
string $charlist
)

###### List of parameters:

Name | Type | Description
--- | --- | ---
$charlist | string | a string of characters that should be unescaped

###### Description:

- access: public
- name: String::removeSlashes()

##### replace a needle with a substitute

int replace (
string $needle, [string $substitute = ""]
)

###### List of parameters:

Name | Type | Description
--- | --- | ---
$needle | string |
$substitute | string | (optional)

###### Description:

This will replace all entities of $needle with $substitute. Returns the number of times $needle is replaced.

- see: String::replaceRegExp()
- access: public
- name: String::replace()

##### replace a substring by using a regular expression

int replaceRegExp (
string $regularExpression, [string $substitute = ""], [int $limit = -1]
)

###### List of parameters:

Name | Type | Description
--- | --- | ---
$regularExpression | string |
$substitute | string | (optional)
$limit | int | (optional) must be a positive integer > 0, defaults to -1 (no limit)

###### Description:

This will replace all hits of the Perl-compatible $regularExpression with $substitute.
Returns the number of times $needle is replaced.

- see: String::replace()
- access: public
- name: String::replaceRegExp()

##### reverse the string value

string &reverse ()

###### Description:

- access: public
- name: String::reverse()

##### set string value

string set (
string $value
)

###### List of parameters:

Name | Type | Description
--- | --- | ---
$value | string | a new string value

###### Description:

Assigns a new value to the object. Returns the old value.

- access: public
- name: String::set()

##### shuffle the string's characters

string &shuffle ()

###### Description:

- access: public
- name: String::shuffle()

##### convert string to an array

array split (
string $separator, int $limit
)

###### List of parameters:

Name | Type | Description
--- | --- | ---
$separator | string |
$limit | int |

###### Description:

- see: String::splitRegExp()
- access: public
- name: String::split()

##### convert string to an array by using regular expression to find a speratator

array splitRegExp (
string $separator, int $limit
)

###### List of parameters:

Name | Type | Description
--- | --- | ---
$separator | string |
$limit | int |

###### Description:

- see: String::split()
- access: public
- name: String::splitRegExp()

##### extract a substring

string &substring (
int $start, int $length
)

###### List of parameters:

Name | Type | Description
--- | --- | ---
$start | int |
$length | int | (optional)

###### Description:

Returns a substring beginning at character-offset $start with $length characters. See PHP-Manual "string functions" "substr()" for details.

- access: public
- name: String::substring()

##### return value as boolean

bool toBool ()

###### Description:

Returns a boolean value depending on the value of the string.

- string("false") returns bool(false)
- string("true") returns bool(true)
- any other value returns a boolean value depending on the result of PHP's internal conversion mechanism, BUT also issues an E_USER_NOTICE for on an invalid string to bool conversion

Note: If you just want to check wether a string is empty or not, use $string->equals("") instead.

- access: public
- name: String::toBool()

##### return value as float

float|bool(false) toFloat ()

###### Description:

Converts the string value to a float and returns it. Returns bool(false) if the string is not numeric.

- access: public
- name: String::toFloat()

##### return value as int

int|bool(false) toInt ()

###### Description:

Converts the string value to an integer and returns it. Returns bool(false) if the string is not numeric.

- access: public
- name: String::toInt()

##### return a lower-cased version of the string

string &toLowerCase ()

###### Description:

- see: String::toUpperCase()
- access: public
- name: String::toLowerCase()

##### Alias of: String::get()

void toString ()

###### Description:

- see: String::get()

Redefinition of: Object::toString()

##### return a upper-cased version of the string

string &toUpperCase ()

###### Description:

- see: String::toLowerCase()
- access: public
- name: String::toUpperCase()

##### OO-Alias of: trim(), chop()

string &trim ()

###### Description:

- access: public
- name: String::trim()

##### wrap a long text

string &wrap (
int $width, [string $break = ""], [bool $cut = false]
)

###### List of parameters:

Name | Type | Description
--- | --- | ---
$width | int |
$break | string |
$cut | bool |

###### Description:

- access: public
- name: String::wrap()

##### inherited from base classes

Inherited From Object

- Object::cloneObject()
- Object::equals()
- Object::getClass()
- Object::serialize()
- Object::toString()

Documentation generated on Sun, 04 Jan 2009 03:49:10 +0100 by phpDocumentor 1.4.0

yana author: Thomas Meyerwww.yanaframework.net