View Javadoc

1   package org.jmage.util;
2   
3   /***
4    * StringUtil
5    */
6   public class TextUtil {
7   
8       public boolean isValue(String value) {
9           return value != null && !"".equals(value.trim());
10      }
11  
12      public boolean isPosNum(String value) {
13          if (this.isValue(value)) {
14              try {
15                  return Integer.valueOf(value).intValue() > 0;
16              } catch (NumberFormatException f) {
17                  return false;
18              }
19          } else {
20              return false;
21          }
22      }
23  
24      public boolean isNum(String value) {
25          if (this.isValue(value)) {
26              try {
27                  Integer.valueOf(value).intValue();
28                  return true;
29              } catch (NumberFormatException f) {
30                  return false;
31              }
32          } else {
33              return false;
34          }
35      }
36  }