01: package watij.utilities;
02:
03: public class Utils {
04:
05: public static String replace(String srcStr, String searchSubStr,
06: String replaceSubStr) {
07: String result = srcStr;
08: while (result.indexOf(searchSubStr) != -1) {
09: int startIndex = result.indexOf(searchSubStr);
10: result = result.substring(0, startIndex)
11: + replaceSubStr
12: + result.substring(startIndex
13: + searchSubStr.length(), result.length());
14: }
15: return result;
16: }
17:
18: public static boolean isEmpty(String string) {
19: return string == null || string.length() == 0;
20: }
21:
22: public static boolean isEmpty(Object object) {
23: return object == null || object.toString().length() == 0;
24: }
25: }
|