We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent bf03378 commit 5d98b7eCopy full SHA for 5d98b7e
src/Pinyin/Pinyin.php
@@ -139,6 +139,8 @@ public static function trans($string, array $settings = array())
139
*/
140
public static function letter($string, array $settings = array())
141
{
142
+ $settings = array_merge($settings, array('accent' => false, 'only_chinese' => true));
143
+
144
$parsed = self::parse($string, $settings);
145
146
return $parsed['letter'];
@@ -212,8 +214,6 @@ public static function appends(array $appends)
212
214
213
215
protected function getFirstLetters($pinyin, $settings)
216
- $pinyin = preg_replace('/\s?[a-zA-Z]+(\b|\s)/', '', $pinyin);
-
217
$letterCase = $settings['uppercase'] ? 'strtoupper' : 'strtolower';
218
219
$letters = array();
0 commit comments