sky.common.util
Class StringUtil

java.lang.Object
  extended bysky.common.util.StringUtil

public class StringUtil
extends java.lang.Object

Additional functions for manipulating strings. $RCSfile: StringUtil.java,v $
$Revision: 1.3 $
$Date: 2005/04/24 03:14:03 $


Constructor Summary
StringUtil()
           
 
Method Summary
static java.lang.String convert(java.lang.String original, int nType)
          Used to convert normal strings into corresponding strings that are formatted as per SQL or HTML syntax rules.
static boolean isNotNull(java.lang.String str)
          Check if a string is either null or empty.
static boolean isNull(java.lang.String str)
          Check if a string is either null or empty.
static java.lang.String replace(java.lang.String str, java.lang.String ot, java.lang.String token, boolean rflg)
          Replaces any occurances of substring ot in string str with string token
static java.lang.String replaceNL(java.lang.String str, java.lang.String token, boolean rflg)
          Replaces any new lines in input string str with token string token
 
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

replace

public static java.lang.String replace(java.lang.String str,
                                       java.lang.String ot,
                                       java.lang.String token,
                                       boolean rflg)
Replaces any occurances of substring ot in string str with string token

Parameters:
str - input string.
ot - substring that will be searched for in the input string.
token - token string for replacing substrings within input strings.
rflg - Not currently used. Set to either true or false.
Returns:
resulting string.

replaceNL

public static java.lang.String replaceNL(java.lang.String str,
                                         java.lang.String token,
                                         boolean rflg)
Replaces any new lines in input string str with token string token

Parameters:
str - input string.
token - token that will replace new line characters input string.
Returns:
resulting string.

convert

public static java.lang.String convert(java.lang.String original,
                                       int nType)
Used to convert normal strings into corresponding strings that are formatted as per SQL or HTML syntax rules. If nType is SkyConst.DATA_SQL all the ' characters in input string will be replaced by ''. However, if input string is null or empty, then the result string will be "NULL" (which is the sql value used to represent missing data items). If nType is SkyConst.DATA_HTML, then all the new line characters in the string will be replaced by <BR>, < characters are replaced by & lt;, and > characters are replaced by & gt;

Parameters:
original - input string that needs to be transformed.
nType - format (SkyConst.DATA_SQL or SkyConst.DATA_HTML) of the input string.
Returns:
string conorming to either SQL or HTML language syntax.

isNotNull

public static boolean isNotNull(java.lang.String str)
Check if a string is either null or empty.

Returns:
true if string is not empty and not null.

isNull

public static boolean isNull(java.lang.String str)
Check if a string is either null or empty.

Returns:
true if string is either null or empty.