JAVA截取字符串右侧指定长度的字符串
文章目录
/**
* JAVA截取字符串右侧指定长度的字符串
*
* @param input 输入字符串
* @param count 截取长度
* @return 截取字符串
*/
public static String right(String input, int count) {
if (isEmpty(input)) {
return "";
}
count = (count > input.length()) ? input.length() : count;
return input.substring(input.length() - count, input.length());
}

评论
登录后参与技术讨论,分享你的经验与见解。
登录 / 注册暂无评论