修复一些消息弹窗的问题
This commit is contained in:
@ -40,4 +40,20 @@ public class StringUtils {
|
||||
|
||||
return displayName + "(" + description + ")";
|
||||
}
|
||||
|
||||
/**
|
||||
* 截取字符串部分长度,超出的以 "..." 代替
|
||||
*
|
||||
* @param text 字符串内容
|
||||
* @param maxLength 最大长度
|
||||
* @return 修饰后的字符串
|
||||
*/
|
||||
public static String shrinkStringWithDot(String text, int maxLength) {
|
||||
if (TextUtils.isEmpty(text)) return "";
|
||||
|
||||
if (text.length() > maxLength) {
|
||||
text = text.substring(0, maxLength) + "...";
|
||||
}
|
||||
return text;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user