PHP 클래스 Bolt\Helpers\Str

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

공개 메소드들

메소드 설명
endsWith ( string $subject, string $search, boolean $caseSensitive = true ) : boolean Returns whether the subjects ends with the search string.
makeSafe ( string $str, boolean $strict = false, string $extrachars = '' ) : string Returns a "safe" version of the given string - basically only US-ASCII and numbers. Needed because filenames and titles and such, can't use all characters.
replaceFirst ( string $search, string $replace, string $subject ) : string Replace the first occurence of a string only. Behaves like str_replace, but replaces _only_ the _first_ occurence.
replaceLast ( string $search, string $replace, string $subject, boolean $caseSensitive = true ) : string Replace only the last occurrence of the $search text on the $subject.
shyphenate ( string $str ) : string Add 'soft hyphens' ­ to a string, so that it won't break layout in HTML when using strings without spaces or dashes. Only breaks in long (> 19 chars) words.

메소드 상세

endsWith() 공개 정적인 메소드

Returns whether the subjects ends with the search string.
public static endsWith ( string $subject, string $search, boolean $caseSensitive = true ) : boolean
$subject string
$search string
$caseSensitive boolean
리턴 boolean

makeSafe() 공개 정적인 메소드

Returns a "safe" version of the given string - basically only US-ASCII and numbers. Needed because filenames and titles and such, can't use all characters.
public static makeSafe ( string $str, boolean $strict = false, string $extrachars = '' ) : string
$str string
$strict boolean
$extrachars string
리턴 string

replaceFirst() 공개 정적인 메소드

Replace the first occurence of a string only. Behaves like str_replace, but replaces _only_ the _first_ occurence.
또한 보기: http://stackoverflow.com/a/2606638
public static replaceFirst ( string $search, string $replace, string $subject ) : string
$search string
$replace string
$subject string
리턴 string

replaceLast() 공개 정적인 메소드

Replace only the last occurrence of the $search text on the $subject.
public static replaceLast ( string $search, string $replace, string $subject, boolean $caseSensitive = true ) : string
$search string
$replace string
$subject string
$caseSensitive boolean
리턴 string

shyphenate() 공개 정적인 메소드

Add 'soft hyphens' ­ to a string, so that it won't break layout in HTML when using strings without spaces or dashes. Only breaks in long (> 19 chars) words.
public static shyphenate ( string $str ) : string
$str string
리턴 string