ITeye博客

2013 年文章归档

共 4 篇文章

空格字符串匹配

最近做中文分词的程序,其中分出来空格的字符串,想着用正则表达式匹配一下,再将其去除,但是用的"\\s+","\\s*"等都不行,最后在 论坛 上求助,得到了解决办法。 public static boolean isNull(String str) { if (null == str || "".equals(str)) { return true; } return false; } 原来null和空串并不是一回事,这个记清楚了。

2013-11-29 22:58

空格字符串匹配

最近做中文分词的程序,其中分出来空格的字符串,想着用正则表达式匹配一下,再将其去除,但是用的"\\s+","\\s*"等都不行,最后在 论坛 上求助,得到了解决办法。 public static boolean isNull(String str) { if (null == str || "".equals(str)) { return true; } return false; } 原来null和空串并不是一回事,这个记清楚了。

2013-11-29 22:58

java 中的Map存取对象

先创建一个类,其中有文本和计数两个属性。 package cn.zhf.test; public class Word { private String text; private int count; public String getText() { return text; } public void setText(String text) { this.text = text; } public int getCount() { return count; } public void setCount(int count) { this.count = count; } } 下面创…

2013-11-22 19:44

java 中的Map存取对象

先创建一个类,其中有文本和计数两个属性。 package cn.zhf.test; public class Word { private String text; private int count; public String getText() { return text; } public void setText(String text) { this.text = text; } public int getCount() { return count; } public void setCount(int count) { this.count = count; } } 下面创…

2013-11-22 19:44