/** * @Title:ReplaceString.java * @Package:com.fusionchart.model * @Description:字符串替换 * @author:Youhaidong(游海东) * @date:2014-1-16 下午11:44:35 * @version V1.0 */ package com.fusionchart.model; /** * 类功能说明 * 类修改者 修改日期 * 修改说明 * <p>Title:ReplaceString.java</p> * <p>Description:游海东个人开发</p> * <p>Copyright:Copyright(c)2013</p> * @author:游海东 * @date:2014-1-16 下午11:44:35 * @version V1.0 */ public class ReplaceString { /** * @Title:main * @Description:字符串替换 * @param:@param args * @return: void * @throws */ public static void main(String[] args) { String str = "Hello,World!"; String replaceStr = str.replace(",", ";"); replaceStr = str.replace("!", "?"); System.out.println(replaceStr); System.out.println(str.replace(",", ";")); } }Hello,World?
Hello;World!