String replace方法

String msgContent = "0101,sadf,342";
		String[] separtors = {"\r" ," " ,"," ,"," ,"." ,"。" ,"#" ,"\"" ,"”"};
		
		System.out.println("转换之前:" + msgContent);
		
		//进行分隔符统一
		for (int i = 0; i < separtors.length; i++) {
			msgContent = msgContent.replace(separtors[i], "#");
			System.out.println("转换之中:" + msgContent);
		}
		
		System.out.println("转换之后:" + msgContent);

低级错误.你有遇到这样问题吗?

你可能感兴趣的:(replace)