完成关于问题详情和答案详情的 MTA 时间统计
This commit is contained in:
@ -1,5 +1,7 @@
|
||||
package com.gh.common.util;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
/**
|
||||
* Created by khy on 2017/5/2.
|
||||
*/
|
||||
@ -21,4 +23,21 @@ public class StringUtils {
|
||||
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 将两个字符串拼接起来,以 "displayName(description)" 的形式返回
|
||||
*
|
||||
* @param displayName 若传入的 displayName 长度大于 30 截取 30 并补充 "..."
|
||||
* @param description 不需额外处理的入参
|
||||
* @return "display(description)"
|
||||
*/
|
||||
public static String combineTwoString(String displayName, String description) {
|
||||
if (TextUtils.isEmpty(displayName) || TextUtils.isEmpty(description)) return "";
|
||||
|
||||
if (displayName.length() > 30) {
|
||||
displayName = displayName.substring(0, 30) + "...";
|
||||
}
|
||||
|
||||
return displayName + "(" + description + ")";
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user