Buglet - buglet.sourceforge.org

org.buglet.util
Class StringUtil

java.lang.Object
  |
  +--org.buglet.util.StringUtil

public class StringUtil
extends java.lang.Object

Container for various static methods used to manipulate Strings.


Field Summary
(package private) static org.apache.log4j.Category log
           
 
Constructor Summary
StringUtil()
           
 
Method Summary
static boolean blankString(java.lang.String val)
          This returns true if the String equals "" or is null.
static java.lang.String blankString(java.lang.String val, java.lang.String defaultVal)
          This converts the String to the default val if it is blank (see next method)
static java.lang.String booleanToCapString(boolean val)
          returns a string representation of a boolean value as a string "TRUE" or "FALSE"
static java.lang.String booleanToString(boolean val)
          returns a string representation of a boolean values as a string "True" or "False"
static java.lang.String booleanToYN(boolean val)
           
static boolean containsClosingXMLTag(java.lang.String line, java.lang.String openingTag)
          Returns true if the line contains the closing XML tag
static boolean containsOpeningXMLTag(java.lang.String line)
          Returns true if the String contains the opening XML tag
static java.lang.String escapeXML(java.lang.String xmlString)
           
static java.lang.String getOpeningXMLTag(java.lang.String line)
          If line contains the opening tag for an XML doc, this returns the opening tag, otherwise null is returned.
static java.lang.String getXMLTagValue(java.lang.String name, java.lang.String line)
          Returns the value contained between the opening and closing tags for name in the given String
static java.lang.String htmlBlank(java.lang.String val)
          This returns
static java.lang.String indent(int number)
           
static java.lang.String indent(java.lang.String indentString, int number)
          Returns an indent string with the given number of indent characters
static boolean isBlankString(java.lang.String val)
           
static java.lang.String pad(java.lang.String targetString, int length, java.lang.String side)
          This pads the targetString with length spaces in the side.
static java.lang.String pad(java.lang.String targetString, java.lang.String padString, int length, java.lang.String side)
          This pads targetString to the given length on side using padString
static java.lang.String removeEOL(java.lang.String line)
          This removes EOL characters (\n or \r) from the given String
static java.lang.String replace(java.lang.String origin, java.lang.String source, java.lang.String dest)
          This replaces instance of source with dest in origin
static boolean stringToBoolean(java.lang.String val)
           
static boolean toBoolean(java.lang.String val)
           
static java.lang.String trueFalseToYN(boolean val)
          returns a string representation of a boolean value as "Y" or "N"
static java.lang.String trueFalseToYN(java.lang.String val)
          This returns Y if the val equals
static boolean YNToBoolean(java.lang.String val)
          This returns true if the input String equals
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

static org.apache.log4j.Category log
Constructor Detail

StringUtil

public StringUtil()
Method Detail

replace

public static java.lang.String replace(java.lang.String origin,
                                       java.lang.String source,
                                       java.lang.String dest)
This replaces instance of source with dest in origin
Parameters:
origin -  
source -  
dest -  

indent

public static java.lang.String indent(int number)

indent

public static java.lang.String indent(java.lang.String indentString,
                                      int number)
Returns an indent string with the given number of indent characters
Parameters:
indentString -  
number -  

removeEOL

public static java.lang.String removeEOL(java.lang.String line)
This removes EOL characters (\n or \r) from the given String
Parameters:
line -  

pad

public static java.lang.String pad(java.lang.String targetString,
                                   int length,
                                   java.lang.String side)
This pads the targetString with length spaces in the side.
Parameters:
targetString -  
length -  
side -  

pad

public static java.lang.String pad(java.lang.String targetString,
                                   java.lang.String padString,
                                   int length,
                                   java.lang.String side)
This pads targetString to the given length on side using padString
Parameters:
targetString -  
padString -  
length -  
side -  

blankString

public static java.lang.String blankString(java.lang.String val,
                                           java.lang.String defaultVal)
This converts the String to the default val if it is blank (see next method)
Parameters:
val -  
defaultVal -  

blankString

public static boolean blankString(java.lang.String val)
This returns true if the String equals "" or is null.
Parameters:
val -  

isBlankString

public static boolean isBlankString(java.lang.String val)

htmlBlank

public static java.lang.String htmlBlank(java.lang.String val)
This returns
 
if the String is blank.
Parameters:
val -  

trueFalseToYN

public static java.lang.String trueFalseToYN(java.lang.String val)
This returns Y if the val equals
"true"
Parameters:
val -  

trueFalseToYN

public static java.lang.String trueFalseToYN(boolean val)
returns a string representation of a boolean value as "Y" or "N"

booleanToString

public static java.lang.String booleanToString(boolean val)
returns a string representation of a boolean values as a string "True" or "False"

booleanToYN

public static java.lang.String booleanToYN(boolean val)

booleanToCapString

public static java.lang.String booleanToCapString(boolean val)
returns a string representation of a boolean value as a string "TRUE" or "FALSE"

YNToBoolean

public static boolean YNToBoolean(java.lang.String val)
This returns true if the input String equals
"Y" or "YES"
Parameters:
val -  

toBoolean

public static boolean toBoolean(java.lang.String val)

stringToBoolean

public static boolean stringToBoolean(java.lang.String val)

containsOpeningXMLTag

public static boolean containsOpeningXMLTag(java.lang.String line)
Returns true if the String contains the opening XML tag
Parameters:
line -  

getOpeningXMLTag

public static java.lang.String getOpeningXMLTag(java.lang.String line)
If line contains the opening tag for an XML doc, this returns the opening tag, otherwise null is returned.
Parameters:
line -  

containsClosingXMLTag

public static boolean containsClosingXMLTag(java.lang.String line,
                                            java.lang.String openingTag)
Returns true if the line contains the closing XML tag
Parameters:
line -  
openingTag -  

getXMLTagValue

public static java.lang.String getXMLTagValue(java.lang.String name,
                                              java.lang.String line)
Returns the value contained between the opening and closing tags for name in the given String
Parameters:
name -  
line -  

escapeXML

public static java.lang.String escapeXML(java.lang.String xmlString)

Buglet - buglet.sourceforge.org

Copyright © 2001 58k.com Inc. All Rights Reserved