JpnForPhp\Transliterator\Kana::prepareChoonpuTransliteration PHP Method

prepareChoonpuTransliteration() protected method

Prepare a string for to transliterate choonpu into kana.
protected prepareChoonpuTransliteration ( string $str ) : string
$str string String to be prepared.
return string Prepared string.
    protected function prepareChoonpuTransliteration($str)
    {
        // Consonant followed by two of the same vowel
        $consonant = 'bcdfghjklmnpqrstvwyz';
        return preg_replace_callback('/(^[' . $consonant . '])(aa|ii|uu|ee|oo)/u', function ($matches) {
            return $matches[1] . substr($matches[2], 1) . 'ー';
        }, $str);
    }