虚拟化--004 your account is no authorized to perform the requested action
2015-08-20 12:01
411 查看
/** * 根据字节数截字 * * @param str * @param subBytes * @return */ public static String subStr(String str, int subBytes) { int bytes = 0; for (int i = 0; i < str.length(); i++) { if (bytes == subBytes) { return str.substring(0, i); } char c = str.charAt(i); if (c < 256) { bytes += 1; // 英文字符的字节数看作 } else { bytes += 2; // 中文字符的字节数看作 if (bytes - subBytes == 1) { return str.substring(0, i); } } } return str.trim(); }
相关文章推荐
- UITableViewCell的重用问题
- IOS开发 - UIApplication的常见使用
- UE4 GPU Profiling
- UE4 CPU Profiling
- UE4 Profiler
- UE4 Performance Guidelines
- UE4 Performance and Profiling
- UE4 Stat Commands
- 获得多行UILabel的每一行内容
- UE4 System Settings
- 80 css ie8下ui-box-head出现阴影效果
- UIAlertView的自动取消的使用
- Unreal4 Build System
- UE4 配置文件
- Cannot insert the value NULL into column 'StuID', table 'NETRepository.dbo.S
- qemu-guest-agent各版本功能演进
- leetcode - Unique Binary Search Trees
- Android 界面—UI开发控件
- java.toString() ,(String),String.valueOf的区别
- UIViewController 之LoadView详解