PHP Класс QString, qcodo

Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
ConvertToCamelCase ( string $strString ) : string Given an underscore_separated_string, this will convert the string to CamelCaseNotation. Note that this will ignore any casing in the underscore separated string.
FirstCharacter ( string $strString ) : string Returns the first character of a given string, or null if the given string is null.
GetByteSize ( integer $intBytes, $intNumberOfTenths = 1 ) : string Given an integer that represents a byte size, this will return a string displaying the value in bytes, KB, MB, GB, TB or PB
IsContainsUtf8 ( string $strString ) : boolean Returns whether or not the given string contains any UTF-8 encoded characters.
IsLengthBeetween ( string $strString, integer $intMinimumLength, integer $intMaximumLength ) : boolean Checks if text length is between given bounds
IsStartsWith ( $strString, $strStartsWith ) : boolean Returns whether or not the given string starts with another string
LastCharacter ( string $strString ) : string Returns the last character of a given string, or null if the given string is null.
ObfuscateEmail ( string $strEmail ) : string Obfuscates an email so that it can be outputted as HTML to the page.
QuotedPrintableEncode ( string $strString ) : string Encodes a given 8-bit string into a quoted-printable string,
StringPosition ( string $strHaystack, string &$strNeedle, integer $intOffset = null ) : mixed Similar to strpos(haystack, needle, [offset]) except "needle" can be a regular expression as well.
StringReversePosition ( string $strHaystack, string &$strNeedle, integer $intOffset = null ) : mixed A better version of strrpos which also allows for the use of RegExp-based matching
Truncate ( $strText, integer $intMaxLength, bololean $blnHtmlEntities = true ) : string Truncates the string to a given length, adding elipses (if needed).
XmlEscape ( string $strString ) : string Escapes the string so that it can be safely used in as an Xml Node (basically, adding CDATA if needed)
__construct ( ) : void This faux constructor method throws a caller exception.

Описание методов

ConvertToCamelCase() публичный статический Метод

Given an underscore_separated_string, this will convert the string to CamelCaseNotation. Note that this will ignore any casing in the underscore separated string.
public static ConvertToCamelCase ( string $strString ) : string
$strString string
Результат string

FirstCharacter() закрытый публичный статический Метод

Returns the first character of a given string, or null if the given string is null.
final public static FirstCharacter ( string $strString ) : string
$strString string
Результат string the first character, or null

GetByteSize() публичный статический Метод

Given an integer that represents a byte size, this will return a string displaying the value in bytes, KB, MB, GB, TB or PB
public static GetByteSize ( integer $intBytes, $intNumberOfTenths = 1 ) : string
$intBytes integer
Результат string

IsContainsUtf8() публичный статический Метод

Uses regexp pattern as originally defined from http://w3.org/International/questions/qa-forms-utf-8.html and modified by [email protected] for efficiency.
public static IsContainsUtf8 ( string $strString ) : boolean
$strString string
Результат boolean whether or not the string contains any UTF-8 characters

IsLengthBeetween() публичный статический Метод

Checks if text length is between given bounds
public static IsLengthBeetween ( string $strString, integer $intMinimumLength, integer $intMaximumLength ) : boolean
$strString string Text to be checked
$intMinimumLength integer Minimum acceptable length
$intMaximumLength integer Maximum acceptable length
Результат boolean

IsStartsWith() закрытый публичный статический Метод

Returns whether or not the given string starts with another string
final public static IsStartsWith ( $strString, $strStartsWith ) : boolean
$strString
$strStartsWith
Результат boolean

LastCharacter() закрытый публичный статический Метод

Returns the last character of a given string, or null if the given string is null.
final public static LastCharacter ( string $strString ) : string
$strString string
Результат string the last character, or null

ObfuscateEmail() публичный статический Метод

Obfuscates an email so that it can be outputted as HTML to the page.
public static ObfuscateEmail ( string $strEmail ) : string
$strEmail string the email address to obfuscate
Результат string the HTML of the obfuscated Email address

QuotedPrintableEncode() публичный статический Метод

Encodes a given 8-bit string into a quoted-printable string,
public static QuotedPrintableEncode ( string $strString ) : string
$strString string the string to encode
Результат string the encoded string

StringPosition() публичный статический Метод

Will only work if both the first and last character of "needle" is "/", signifying a regexp-based search. NOTE: If a regexp was used, needle WILL be modified to reflect the actual string literal found/used in the search.
public static StringPosition ( string $strHaystack, string &$strNeedle, integer $intOffset = null ) : mixed
$strHaystack string the contents to search through
$strNeedle string the search term itself (either a literal string OR a regexp value)
$intOffset integer optional offset value
Результат mixed the position number OR false if not found

StringReversePosition() публичный статический Метод

A better version of strrpos which also allows for the use of RegExp-based matching
public static StringReversePosition ( string $strHaystack, string &$strNeedle, integer $intOffset = null ) : mixed
$strHaystack string the text content to search through
$strNeedle string either a plain-text item or a regexp pattern item to search for - if regexp used, this will update as the actual string of the content found
$intOffset integer optional position offset
Результат mixed the position number OR false if not found

Truncate() закрытый публичный статический Метод

Truncates the string to a given length, adding elipses (if needed).
final public static Truncate ( $strText, integer $intMaxLength, bololean $blnHtmlEntities = true ) : string
$intMaxLength integer the maximum possible length of the string to return (including length of the elipse)
$blnHtmlEntities bololean whether or not to escape the text with htmlentities first
Результат string the full string or the truncated string with eplise

XmlEscape() закрытый публичный статический Метод

Escapes the string so that it can be safely used in as an Xml Node (basically, adding CDATA if needed)
final public static XmlEscape ( string $strString ) : string
$strString string string to escape
Результат string the XML Node-safe String

__construct() закрытый публичный Метод

The String object should never be instantiated, and this constructor override simply guarantees it.
final public __construct ( ) : void
Результат void