java按字节截取中英文混合字符串
来源:互联网 发布:linux中chmod -r 777 编辑:程序博客网 时间:2024/05/30 23:53
public String subStringByByte(String str, int len){
String result = null;
if(str != null){
byte[] a = str.getBytes();
if(a.length <= len){
result = str;
}else if(len > 0){
result = new String(a, 0, len);
System.out.println(result);
int length = result.length();
if(str.charAt(length - 1) != result.charAt(length-1)){
if(length < 2){
result = null;
}else{
result = result.substring(0, length - 1);
}
}
}
}
return result;
}
String result = null;
if(str != null){
byte[] a = str.getBytes();
if(a.length <= len){
result = str;
}else if(len > 0){
result = new String(a, 0, len);
System.out.println(result);
int length = result.length();
if(str.charAt(length - 1) != result.charAt(length-1)){
if(length < 2){
result = null;
}else{
result = result.substring(0, length - 1);
}
}
}
}
return result;
}
- java按字节截取中英文混合字符串
- javascript_按字节截取、计算中英文混合字符串字节数
- Java截取中英文混合字符串
- Java 截取中英文混合字符串
- Java 截取中英文混合字符串
- 截取中英文混合字符串
- 截取中英文混合字符串
- 中英文混合字符串截取
- 中英文混合字符串截取
- 使用 sql、 javascript 按字节截取、计算中英文混合字符串字节数
- (JAVA)截取中英文混合字符串
- (JAVA)截取中英文混合字符串
- js通过字节长度截取中英文混合字符串
- C# 中英文混合字符串截取
- js截取中英文混合字符串
- Cocos2dx中英文混合字符串截取
- php截取中英文混合字符串
- 字符串中英文混合前后截取
- 算法导论 16.1-1活动选择问题的动态规划算法 答案
- C#和.NET基础知识——学习笔记(四)
- Qt5.1.1 for android 环境配置
- android下基本json串的生成与解析
- 线程执行器
- java按字节截取中英文混合字符串
- Oracle Privileges and Roles
- sqlplus时不能用Backspace来删除字符的解决
- Color Picker ASP.NET AJAX Extender Control
- Usage of Array in Perl
- iOS开发中那些高效常用的宏
- 程序员的职场潜意识Top10
- Android WebView-应用内嵌入浏览器
- 理解java数组