From: Eric P. <th...@us...> - 2010-03-08 23:11:43
|
Update of /cvsroot/sandev/sand/apps/basics/src/org/sandev/basics/util In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv2789 Modified Files: StringUtil.java Log Message: Added sameText comparison utility. Index: StringUtil.java =================================================================== RCS file: /cvsroot/sandev/sand/apps/basics/src/org/sandev/basics/util/StringUtil.java,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** StringUtil.java 1 Mar 2010 19:10:17 -0000 1.39 --- StringUtil.java 8 Mar 2010 23:11:33 -0000 1.40 *************** *** 1397,1400 **** --- 1397,1416 ---- /** + * Return true if both strings are null, or if they are both not + * null and the trimmed values are equivalent ignoring case. + */ + public static boolean sameText(String str1,String str2) + { + if((str1==null)&&(str2==null)) { + return true; } + else if((str1==null)||(str2==null)) { + return false; } + else if(str1.trim().equalsIgnoreCase(str2.trim())) { + return true; } + return false; + } + + + /** * Returns true if the given string is a valid java identifier, false * otherwise. |