相信大家都看过很多关于String 与StringBuffer的区别,自从Java 5.0发布以后,我们的比较列表上将多出一个对象了,这就是StringBuilder类,String类是不可变的任何String对象做了改变都会引发一个新的对象生成。而StringBuffer则是可变类,任何对它所指代的字符串的改变都不会产生新的对象,使用StringBuffer提程序的性能。
那为什么在j...
分类:
其他好文 时间:
2015-01-08 11:24:21
阅读次数:
154
org.apache.commons.lang.StringUtils中常用的方法,这里主要列举String中没有,且比较有用的方法:1. 检查字符串是否为空:static boolean isBlank(CharSequence str) 判断字符串是否为空或null; static boolea...
分类:
其他好文 时间:
2015-01-08 11:08:42
阅读次数:
149
由于Lucene4.9.1的QueryParser支持类似Solr的范围检索( FL:[ 111 TO 222] ) 但是实际中会出现不准确的现象。这是由于QueryParser 把范围查询当做String类型。而无论索引时使用LongField 和 TextField 都会出现不准确问题。解决办法...
分类:
Web程序 时间:
2015-01-08 10:56:43
阅读次数:
226
手动给DataTable添加数据DataTable tab = new DataTable();tab.Columns.Add("id", typeof(int));//添加列名tab.Columns.Add("name", typeof(string));//添加列名//tab.Rows.Add(...
分类:
其他好文 时间:
2015-01-08 10:51:29
阅读次数:
141
The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like
this: (you may want to display this pattern in a fixed font for better legibility)
P A H N
A P L S I ...
分类:
其他好文 时间:
2015-01-08 09:43:54
阅读次数:
174
Implement atoi to convert a string to an integer.
Hint: Carefully consider all possible input cases. If you want a challenge, please do not see below and ask yourself what are the possible input ca...
分类:
其他好文 时间:
2015-01-08 09:41:06
阅读次数:
187
/**
* 将字符串的xml转换成org.w3c.dom.Document对象
* @param xml
* @return
*/
public static Document getDocument(String xml) {
Document document = null;
try {
...
分类:
其他好文 时间:
2015-01-08 09:40:00
阅读次数:
152
【案例1】通过一个对象获得完整的包名和类名123456789101112131415packageReflect;/*** 通过一个对象获得完整的包名和类名* */classDemo{//other codes...}classhello{publicstaticvoidmain(String[] ...
分类:
编程语言 时间:
2015-01-08 09:28:37
阅读次数:
175
// 反射调用某个对象的方法 public Object invokeMethod(Object methodObject, String methodName, Object[] args) throws Exception { Class ownerClass = methodObjec...
分类:
编程语言 时间:
2015-01-08 09:25:50
阅读次数:
134
function GenerateVerifyCode(var code:string):TBitmap;var I,j,k: Integer; vPoint: TPoint; vLeft: Integer; arrStr:array [1..36]of string ; vc...