org.xenbase.utilities
Class StringUtil

java.lang.Object
  extended by org.xenbase.utilities.StringUtil

public class StringUtil
extends java.lang.Object


Constructor Summary
StringUtil()
           
 
Method Summary
static java.lang.String convertUrl(java.lang.String url)
          Utility function that sanitizes a string so it can be used as a URL
static java.lang.String removeDuplicateWhitespace(java.lang.String inputStr)
          Utility function that removes excess whitespace, this was included because of some peculiar formatting in the captions of some journals.
static java.lang.String stripHTMLTags(java.lang.String message)
          Utility function that removes XML or HTML tags from a string.
static java.lang.String unescapeHTML(java.lang.String text)
          Utility function that un-escapes all of the HTML character entities that may be in the caption body.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StringUtil

public StringUtil()
Method Detail

removeDuplicateWhitespace

public static java.lang.String removeDuplicateWhitespace(java.lang.String inputStr)
                                                  throws java.lang.Exception,
                                                         java.lang.Error
Utility function that removes excess whitespace, this was included because of some peculiar formatting in the captions of some journals.

Parameters:
String - inputStr
Returns:
String
Throws:
java.lang.Exception
java.lang.Error

stripHTMLTags

public static java.lang.String stripHTMLTags(java.lang.String message)
                                      throws java.lang.Exception,
                                             java.lang.Error
Utility function that removes XML or HTML tags from a string. It is possible that a string could be constructed which would could be identified as falsely containing a tag. However this case is remote and as such, has not been addressed.

Parameters:
String - message
Returns:
String message without XML or HTML
Throws:
java.lang.Exception
java.lang.Error

convertUrl

public static java.lang.String convertUrl(java.lang.String url)
                                   throws java.lang.Exception,
                                          java.lang.Error
Utility function that sanitizes a string so it can be used as a URL

Parameters:
String - URL
Returns:
String
Throws:
java.lang.Exception
java.lang.Error

unescapeHTML

public static java.lang.String unescapeHTML(java.lang.String text)
                                     throws java.lang.Exception,
                                            java.lang.Error
Utility function that un-escapes all of the HTML character entities that may be in the caption body. This turns them into human readable UTF-8 (Uni-code) characters.

Parameters:
String - URL
Returns:
String
Throws:
java.lang.Exception
java.lang.Error