PHP 클래스 QString, qcodo

파일 보기 프로젝트 열기: qcodo/qcodo 1 사용 예제들

공개 메소드들

메소드 설명
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