随笔分类 -  java

摘要:列子: public static void main(String[] args) throws IOException { File file = new File("F:\\jimmy\\a.txt"); if(!file.exists()) file.createNewFile(); OutputStream out = new FileOutputStream(file); out.write(new String("我\n勒\n了\n个\n去").getBytes()); out.close(); }打开文本,里面内容为:我■勒■了■个■去。 阅读全文
posted @ 2011-08-12 13:21 Spring MVC 3 阅读(521) 评论(0) 推荐(0)
摘要:import java.util.regex.Matcher;import java.util.regex.Pattern;//正则表达式替换字符方法public class PatternReplaceExmple{ private static Pattern p ; private static Matcher m ; //str为要匹配的字符格式 public static void setPattern(String str){ p = Pattern.compile(str); } public static void setPattern(String str,... 阅读全文
posted @ 2009-12-25 16:59 Spring MVC 3 阅读(707) 评论(0) 推荐(0)