PHP 클래스 Jyxo\StringUtil

저자: Jan Tichý
저자: Jakub Tománek
저자: Jaroslav Hanslík
파일 보기 프로젝트 열기: jyxo/php 1 사용 예제들

공개 메소드들

메소드 설명
crc ( string $string ) : integer Generates a crc checksum same on 32 and 64-bit platforms.
cut ( string $string, integer $max = 50, string $etc = '...' ) : string Trims a string to given length.
cutWords ( string $string, integer $length = 25, string $etc = '...' ) : string Trims all words in a string longer than given length.
escape ( string $string, integer $quoteStyle = ENT_QUOTES, boolean $doubleEncode = false ) : string Htmlspecialchars function alias with some parameters automatically set.
fixLineEnding ( string $string, string $lineEnd = " " ) : string Fixes and unifies line endings in a string.
formatBytes ( float $size, string $decimalPoint = ',', string $thousandsSeparator = ' ' ) : string Converts given size in bytes to kB, MB, GB, TB or PB and appends the appropriate unit.
lcfirst ( string $string ) : string Converts first character of a string to lowercase.
obfuscateEmail ( string $email, boolean $comment = false ) : string Obfuscates an email address.
random ( integer $length ) : string Generates a random string of given length.

메소드 상세

crc() 공개 정적인 메소드

Generates a crc checksum same on 32 and 64-bit platforms.
public static crc ( string $string ) : integer
$string string Input string
리턴 integer

cut() 공개 정적인 메소드

Trims at word boundaries (all non-alphanumeric characters are considered delimiters). If the given string is trimmed, an "etc" is added at the end. Its length is also considered.
public static cut ( string $string, integer $max = 50, string $etc = '...' ) : string
$string string Trimmed string
$max integer Maximum length
$etc string "etc" definition
리턴 string

cutWords() 공개 정적인 메소드

String is delimited by whitespaces. If a word is trimmed, an "etc" is added at the end. Its length is also considered.
public static cutWords ( string $string, integer $length = 25, string $etc = '...' ) : string
$string string Processed string
$length integer Maximum word length
$etc string "etc" definition
리턴 string

escape() 공개 정적인 메소드

Htmlspecialchars function alias with some parameters automatically set.
public static escape ( string $string, integer $quoteStyle = ENT_QUOTES, boolean $doubleEncode = false ) : string
$string string Input string
$quoteStyle integer Quote style
$doubleEncode boolean Prevent from double encoding
리턴 string

fixLineEnding() 공개 정적인 메소드

Fixes and unifies line endings in a string.
public static fixLineEnding ( string $string, string $lineEnd = " " ) : string
$string string String to fix
$lineEnd string Desired line ending
리턴 string

formatBytes() 공개 정적인 메소드

Converts given size in bytes to kB, MB, GB, TB or PB and appends the appropriate unit.
public static formatBytes ( float $size, string $decimalPoint = ',', string $thousandsSeparator = ' ' ) : string
$size float Input size
$decimalPoint string Decimal point
$thousandsSeparator string Thousands separator
리턴 string

lcfirst() 공개 정적인 메소드

Works correctly with multibyte encodings.
public static lcfirst ( string $string ) : string
$string string Input string
리턴 string

obfuscateEmail() 공개 정적인 메소드

Obfuscates an email address.
public static obfuscateEmail ( string $email, boolean $comment = false ) : string
$email string Email address
$comment boolean Put a comment into the address
리턴 string

random() 공개 정적인 메소드

Generates a random string of given length.
public static random ( integer $length ) : string
$length integer String length
리턴 string