PHP 클래스 JpnForPhp\Helper\Helper

저자: Matthieu Bilbille (@mbilbille)
파일 보기 프로젝트 열기: mbilbille/jpnforphp 1 사용 예제들

공개 메소드들

메소드 설명
charAt ( string $str, integer $index ) : string Returns the character at the specified index.
convertHiraganaToKatakana ( string $str ) : string Convert the given string from hiragana to katakana.
convertKatakanaToHiragana ( string $str ) : string Convert the given string from katakana to hiragana.
countSubString ( string $str, string $needle ) : integer Counts the number of substring occurrences.
extractHiragana ( string $str, integer $length, boolean $yoon = false ) : array Split a given string to extract hiragana substrings.
extractKana ( string $str, integer $length, boolean $yoon = false ) : array Split a given string to extract kana substrings.
extractKanji ( string $str, integer $length ) : array Split a given string to extract kanji substrings.
extractKatakana ( string $str, integer $length, boolean $yoon = false ) : array Split a given string to extract katakana substrings.
removeMacrons ( string $str ) : string Remove macrons from the specified string.
split ( string $str, integer $length = 1, boolean $yoon = false ) : array Enhance default splitter function to handle UTF-8 characters.
subString ( string $str, integer $begin, integer $length ) : string Returns a new string that is a substring of the given string.
trim ( string $str ) : string Enhance default trim() to trim unicode whitespace.

메소드 상세

charAt() 공개 정적인 메소드

Returns the character at the specified index.
또한 보기: subString()
public static charAt ( string $str, integer $index ) : string
$str string The input string.
$index integer The index of the character to return (0 based indexing).
리턴 string The character at the specified index.

convertHiraganaToKatakana() 공개 정적인 메소드

Simply wrap the mb_convert_kana function.
public static convertHiraganaToKatakana ( string $str ) : string
$str string String to be converted.
리턴 string Converted string.

convertKatakanaToHiragana() 공개 정적인 메소드

Simply wrap the mb_convert_kana function.
public static convertKatakanaToHiragana ( string $str ) : string
$str string String to be converted.
리턴 string Converted string.

countSubString() 공개 정적인 메소드

Counts the number of substring occurrences.
또한 보기: mb_substr_count()
public static countSubString ( string $str, string $needle ) : integer
$str string The input string.
$needle string The string being found.
리턴 integer The number of times the needle substring occurs in the input string.

extractHiragana() 공개 정적인 메소드

Split a given string to extract hiragana substrings.
public static extractHiragana ( string $str, integer $length, boolean $yoon = false ) : array
$str string The input string.
$length integer (optional) Define an optional substring length. Default to 0 which means substrings will be returned as it is.
$yoon boolean (optional) Whether considering the base syllable and the following yoon character as a single character or not Default to false.
리턴 array An array of hiragana substrings.

extractKana() 공개 정적인 메소드

Split a given string to extract kana substrings.
public static extractKana ( string $str, integer $length, boolean $yoon = false ) : array
$str string The input string.
$length integer (optional) Define an optional substring length. Default to 0 which means substrings will be returned as it is.
$yoon boolean (optional) Whether considering the base syllable and the following yoon character as a single character or not Default to false.
리턴 array An array of kana substrings.

extractKanji() 공개 정적인 메소드

Split a given string to extract kanji substrings.
public static extractKanji ( string $str, integer $length ) : array
$str string The input string.
$length integer (optional) Define an optional substring length. Default to 0 which means substrings will be returned as it is.
리턴 array An array of kanji substrings.

extractKatakana() 공개 정적인 메소드

Split a given string to extract katakana substrings.
public static extractKatakana ( string $str, integer $length, boolean $yoon = false ) : array
$str string The input string.
$length integer (optional) Define an optional substring length. Default to 0 which means substrings will be returned as it is.
$yoon boolean (optional) Whether considering the base syllable and the following yoon character as a single character or not Default to false.
리턴 array An array of katakana substrings.

removeMacrons() 공개 정적인 메소드

Based on Wordpress remove_accents().
public static removeMacrons ( string $str ) : string
$str string The input string.
리턴 string Cleaned string.

split() 공개 정적인 메소드

Enhance default splitter function to handle UTF-8 characters.
public static split ( string $str, integer $length = 1, boolean $yoon = false ) : array
$str string The string to split.
$length integer (optional) Define an optional substring length. Default to 1.
$yoon boolean (optional) Whether considering the base syllable and the following yoon character as a single character or not Default to false.
리턴 array An array of strings.

subString() 공개 정적인 메소드

Returns a new string that is a substring of the given string.
또한 보기: mb_substr()
public static subString ( string $str, integer $begin, integer $length ) : string
$str string The input string.
$begin integer The beginning index, inclusive.
$length integer Maximum number of characters to use from str.
리턴 string A substring

trim() 공개 정적인 메소드

Enhance default trim() to trim unicode whitespace.
public static trim ( string $str ) : string
$str string The input string.
리턴 string A cleaned string.