Skip to content

Commit

Permalink
First letters bugfix overtrue#27
Browse files Browse the repository at this point in the history
  • Loading branch information
overtrue committed Oct 21, 2015
1 parent bf03378 commit 5d98b7e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Pinyin/Pinyin.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@ public static function trans($string, array $settings = array())
*/
public static function letter($string, array $settings = array())
{
$settings = array_merge($settings, array('accent' => false, 'only_chinese' => true));

$parsed = self::parse($string, $settings);

return $parsed['letter'];
Expand Down Expand Up @@ -212,8 +214,6 @@ public static function appends(array $appends)
*/
protected function getFirstLetters($pinyin, $settings)
{
$pinyin = preg_replace('/\s?[a-zA-Z]+(\b|\s)/', '', $pinyin);

$letterCase = $settings['uppercase'] ? 'strtoupper' : 'strtolower';

$letters = array();
Expand Down

0 comments on commit 5d98b7e

Please sign in to comment.