修改徽章入口问题
This commit is contained in:
@ -70,4 +70,49 @@ public class StringUtils {
|
||||
}
|
||||
return text;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除尾部\n字符
|
||||
*
|
||||
* @param str
|
||||
* @return
|
||||
*/
|
||||
public static String deleteStringTailLineBreak(String str) {
|
||||
if (TextUtils.isEmpty(str)) {
|
||||
return str;
|
||||
}
|
||||
|
||||
if (str.length() == 1) {
|
||||
char ch = str.charAt(0);
|
||||
if (ch == '\n') {
|
||||
return "";
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
int lastIdx = str.length() - 1;
|
||||
char last = str.charAt(lastIdx);
|
||||
|
||||
if (last == '\n') {
|
||||
return str.substring(0, lastIdx);
|
||||
} else {
|
||||
return str;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断字符串末尾是否有\n
|
||||
* @param str
|
||||
* @return
|
||||
*/
|
||||
public static boolean isStringTailHasLineBreak(String str) {
|
||||
if (TextUtils.isEmpty(str)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
int lastIdx = str.length() - 1;
|
||||
char last = str.charAt(lastIdx);
|
||||
|
||||
return last == '\n';
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user