org.dbforms.util
Class StringUtil

java.lang.Object
  extended by org.dbforms.util.StringUtil

public class StringUtil
extends Object

This utility-class provides convenience methods for parsing strings and generating certain data structures

Author:
Joe Peer

Constructor Summary
StringUtil()
           
 
Method Summary
static String getEmbeddedString(String str, int afterDelims, char delim)
          Method for parsing substring embedded by constant delimeters.
static int getEmbeddedStringAsInteger(String str, int afterDelims, char delim)
          Get the int value of the substring contained between the afterDelims delimiter occurence and the next one
static String getEmbeddedStringWithoutDots(String str, int afterDelims, char delim)
          Method for parsing substring embedded by constant delimeters
Because getEmbeddedString() support "." for image button, this method do the the same, but ignore dots.
static Vector splitString(String str, String delimeter)
          Get a Vector object containing all the tokens related to the input string, splitted using the input delimiter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StringUtil

public StringUtil()
Method Detail

getEmbeddedString

public static String getEmbeddedString(String str,
                                       int afterDelims,
                                       char delim)
Method for parsing substring embedded by constant delimeters.
consider the following string s: ac_update_3_12
  getEmbeddedString(s, 0, '_') ==> "ac"
  getEmbeddedString(s, 1, '_') ==> "update"
  getEmbeddedString(s, 2, '_') ==> "3"
  getEmbeddedString(s, 3, '_') ==> "12"
  getEmbeddedString(s, 3, '_') ==> will throw a Runtime Exception
 

Parameters:
str - the string to parse
afterDelims - the delimiter occurence where to start to parse
delim - the delimiter string
Returns:
the substring contained between the afterDelims delimiter occurence and the next one

getEmbeddedStringAsInteger

public static int getEmbeddedStringAsInteger(String str,
                                             int afterDelims,
                                             char delim)
Get the int value of the substring contained between the afterDelims delimiter occurence and the next one

Parameters:
str - the string to parse
afterDelims - the delimiter occurence where to start to parse
delim - the delimiter string
Returns:
the int value of the substring contained between the afterDelims delimiter occurence and the next one

getEmbeddedStringWithoutDots

public static String getEmbeddedStringWithoutDots(String str,
                                                  int afterDelims,
                                                  char delim)
Method for parsing substring embedded by constant delimeters
Because getEmbeddedString() support "." for image button, this method do the the same, but ignore dots. It's a patch and must be revised in the next cleanup... #checkme
consider the following string s: English-001:param1, param2
  getEmbeddedString(s, 0, '_') ==> ""
  getEmbeddedString(s, 1, '_') ==> ""
  getEmbeddedString(s, 2, '_') ==> ""
  getEmbeddedString(s, 3, '_') ==> ""
  getEmbeddedString(s, 3, '_') ==> will throw a Runtime Exception
 

Parameters:
str - the string to parse
afterDelims - the delimiter occurence where to start to parse
delim - the delimiter string
Returns:
the substring contained between the afterDelims delimiter occurence and the next one

splitString

public static Vector splitString(String str,
                                 String delimeter)
Get a Vector object containing all the tokens related to the input string, splitted using the input delimiter.

Parameters:
str - the string to split
delimeter - the delimiter string
Returns:
a Vector object containing all the tokens related to the input string


Copyright © 2002-2006 DbForms. All Rights Reserved.