All Packages Class Hierarchy This Package Previous Next Index
Class ibs.util.EbfUtils
java.lang.Object
|
+----ibs.util.EbfUtils
- public class EbfUtils
- extends Object
-
EbfUtils()
-
-
isEmpty(String)
-
-
padString(String, String, int)
-
-
parseKeyValuePairs(String)
- Parses string of following format and converts it into a hashtable.
-
parseKeyValuePairs(String, String)
- Parses string of following format and converts it into a hashtable.
-
toBoolean(String)
- Convert String into a boolean.
-
toBoolean(String, boolean)
- Convert String into a boolean.
-
toInt(String)
- Convert String into an int.
-
toInt(String, int)
- Convert String into an int.
-
toString(boolean)
- Convert boolean into a String
-
toString(int)
- Convert an int into the String.
-
toVector(String)
- Convert semicolon-seperated list (String) to a String Array.
-
toVector(String, String, String)
- Convert list of values (String) to a Vector.
-
toVector(String, String, String, int)
- Convert list of values (String) to a String Array.
EbfUtils
public EbfUtils()
isEmpty
public static boolean isEmpty(String s)
toInt
public static int toInt(String s)
- Convert String into an int.
toInt
public static int toInt(String s,
int default_value)
- Convert String into an int.
toBoolean
public static boolean toBoolean(String s)
- Convert String into a boolean. If given string does not contain
any of following values, it returns default return value 'false'.
YES, TRUE, ENABLE, ENABLED - returns true (case does not matter).
NO, FALSE, DISABLE, DISABLED - returns false (case does not matter).
- Parameters:
- s - A String to be converted to the boolean value.
- Returns:
- A boolean value
toBoolean
public static boolean toBoolean(String s,
boolean defaultvalue)
- Convert String into a boolean. If given string does not contain
any of following values, it returns defaultvalue.
YES, TRUE, ENABLE, ENABLED - returns true (case does not matter).
NO, FALSE, DISABLE, DISABLED - returns false (case does not matter).
- Parameters:
- s - A String to be converted to the boolean value.
- defaultvalue - A boolean default value to be returned if given string
did not contain a valid value.
- Returns:
- A boolean value
toString
public static String toString(boolean b)
- Convert boolean into a String
toString
public static String toString(int i)
- Convert an int into the String.
toVector
public static Vector toVector(String semicolon_seperated_list)
- Convert semicolon-seperated list (String) to a String Array.
- Parameters:
- s - semicolon_seperated_list A list seperated by semi-colons.
- Returns:
- A Vector containing all values extracted from the list.
toVector
public static Vector toVector(String list_of_values,
String field_separator,
String text_qualifier)
- Convert list of values (String) to a Vector.
- Parameters:
- list_of_values - A list of values seperated by
field_separator
- field_separator - A field separator used in the list values.
- text_qualifier - -- This is not available at this time --
Supplied value is IGNORED.
- Returns:
- A Vector containing all values extracted from the list.
toVector
public static Vector toVector(String list_of_values,
String field_separator,
String text_qualifier,
int max_elements)
- Convert list of values (String) to a String Array.
Note: This method is dangerous. It uses StreamTokenizer class which
has a bug. It ignores a token if it was null. What I mean is, if your
list of values had format of formid,formname,status, but if it
looked like formid,,status,, you've got a major problem. StreamTokenizer
returns only two tokens formid and status.
Workaround: make sure your record looks likeformid, ,status,.
- Parameters:
- list_of_values - A list of values seperated by
field_separator
- field_separator - A field separator used in the list values.
- text_qualifier - This parameter is not used at this time --
Supplied value is IGNORED.
- max_elements - maximum number of elements to be extracted from the list.
Remaining list values will be ignored.
- Returns:
- A Vector containing all values extracted from the list.
padString
public static String padString(String str,
String pad_with,
int str_length)
parseKeyValuePairs
public static Hashtable parseKeyValuePairs(String str)
- Parses string of following format and converts it into a hashtable.
key1=value1;key2=value2;key3=value3; .......
- Parameters:
- str - A string containing key value pairs seperated by ; (semi-colon).
- Returns:
- A hashtable containing keys and values.
If no key=values parsed, returns empty hashtable.
parseKeyValuePairs
public static Hashtable parseKeyValuePairs(String str,
String pair_separator)
- Parses string of following format and converts it into a hashtable.
For example, key1=value1;key2=value2;key3=value3; ....... ( pairs are seperated using ; )
- Parameters:
- str - A string containing key value pairs seperated by pair_separator.
- Returns:
- A hashtable containing keys and values.
If no key=values parsed, returns empty hashtable.
All Packages Class Hierarchy This Package Previous Next Index