java去除字符串后面的\0
java去除字符串后面的\0
private String filterCode(String string) {
if (string != null) {
string = string.trim();
byte[] zero = new byte[1];
zero[0] = (byte) 0;
String s = new String(zero);
string = string.replace(s, "");
}
return string;
}
java去除字符串后面的\0的更多相关文章
- Java 去除字符串前后指定的字符
一.去除字符串中的中文字符. /** * 去除字符串中的中文字符 * * 示例:brandName值为: 中国ABCD88深圳 * * 返回: ABCD88 * * @param brandName ...
- Java去除字符串中 除数字和逗号以外的符号
例: public static void main(String[] args) { // 去除字符串中 除数字和逗号以外的符号 String str = "_1066,_1068,_10 ...
- java去除字符串中的空格、回车、换行符、制表符
import java.util.regex.Matcher; import java.util.regex.Pattern; /** * @author chzeze * 2016-11-07 */ ...
- Java去除字符串中的空格
特别注意了 Strim或者Trip都是只能去除头部和尾部的空字符串.中间的部分是不能够去除的! 推荐使用ApacheCommonse的StringUtils.deleteWhitespace(&quo ...
- 换行符java去除字符串中的空格、回车、换行符、制表符
import java.util.regex.Matcher; import java.util.regex.Pattern; /** * @author lei * 2011-9-2 */ publ ...
- JAVA去掉字符串前面的0
最佳方案:使用正则 String str = "000000001234034120"; String newStr = str.replaceAll("^(0+)&qu ...
- Java——去除字符串中的中文
import java.util.regex.Matcher; import java.util.regex.Pattern; public class RemoveStrChinese { priv ...
- Java 去除字符串中的空白字符
通过String的trim()方法只能去掉字符串两端的空格字符,但是对于\t \n等其它空白字符确不能去掉,因此需通过正则表达式,将其中匹配到的空白字符去掉,代码如下: protected Strin ...
- java去除字符串中的特殊符号或指定的字符
String regEx="[\n`~!@#$%^&*()+=|{}':;',\\[\\].<>/?~!@#¥%……&*()——+|{}[]‘::”“’., .? ...
随机推荐
- CentOS 7解压安装PHP7.1.21
下载php yum install -y wget wget http://cn2.php.net/distributions/php-7.1.21.tar.gz 解压 tar -zxvf php-7 ...
- AT91 USB Composite Driver Implementation
AT91 USB Composite Driver Implementation 1. Introduction The USB Composite Device is a general way t ...
- [Deepin 15] 安装 Java 8、Git、Firefox、SafeEyes(定时提醒休息工具)
一.安装 JDK 8 1.到官网,用 迅雷下载 安装包 (jdk-8u131-linux-x64.tar.gz) 2.解压放到目录 /opt/software/jdk 3.配置环境变量 sudo vi ...
- C#基于SMTP协议和SOCKET通信,实现邮件内容和附件的发送,并可隐藏收件人
经过几天的努力,从完全不懂SMTP到折腾出个可以发送邮件内容和附件的DEMO.话少说,直接上代码. using System; using System.Collections.Generic; us ...
- chrome ui源码剖析-Accelerator(快捷键)
好久没有自己写东西了,chrome有着取之不尽的技术精华供学习,记录一下. 源码目录: http://src.chromium.org/viewvc/chrome/trunk/src/ui/bas ...
- oracle sql 高级
1 时间 如果是从当前时间到前一个月的这个时候之间的记录总条数: select count(1) from uis_md_stcustom u where firsttime betw ...
- HP Notebook PCs - Updating the BIOS
HP Notebook PCs - Updating the BIOS Updating the BIOS Updating the BIOS when Windows does not start ...
- 执行nova-manage db sync时出错,提示’Specified key was too long; max key length is 1000 bytes’
执行nova-manage db sync时出错: 2012-03-24 14:07:01 CRITICAL nova [-] (OperationalError) (1071, ‘Specified ...
- delphi udp文件传输
客户端: unit UnitClient; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Contr ...
- mysql time zone时区的错误解决
错误提示: The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more than one time zon ...