mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-12-07 01:28:34 +08:00
add null check
This commit is contained in:
parent
365c56b2f8
commit
abda118f72
@ -126,12 +126,12 @@ public class PinyinUtil {
|
|||||||
/**
|
/**
|
||||||
* 将输入字符串转为拼音首字母,其它字符原样返回
|
* 将输入字符串转为拼音首字母,其它字符原样返回
|
||||||
*
|
*
|
||||||
* @param str 任意字符,汉字返回拼音,非汉字原样返回
|
* @param str 任意字符,汉字返回拼音,非汉字原样返回,{@code null}返回{@code null}
|
||||||
* @param separator 分隔符
|
* @param separator 分隔符
|
||||||
* @return 汉字返回拼音,非汉字原样返回
|
* @return 汉字返回拼音,非汉字原样返回;str为{@code null}返回{@code null}
|
||||||
*/
|
*/
|
||||||
public static String getFirstLetter(final String str, final String separator) {
|
public static String getFirstLetter(final String str, final String separator) {
|
||||||
return getEngine().getFirstLetter(str, separator);
|
return (str == null) ? null :getEngine().getFirstLetter(str, separator);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user