net.sourceforge.rssowl.util.shop
Class StringShop

java.lang.Object
  extended bynet.sourceforge.rssowl.util.shop.StringShop

public class StringShop
extends Object

Class provides some methods to handle / work with Strings.

Version:
1.1.3
Author:
Benjamin Pasero

Field Summary
static String AUTH_TOKENIZER
          Custom Tokenizer for Authentication Strings
static String CAT_TOKENIZER
          Custom Tokenizer for Category Path
 
Constructor Summary
private StringShop()
          This utility class constructor is hidden
 
Method Summary
static String createAnchor(String url)
          Create a HTML anchor from the given URL.
static String createFileName(String str)
          Create a valid filename from the given String.
static String hrTrim(String str, int limit)
          Trim the given String to the given Limit.
static boolean isset(String str)
          Returns TRUE in case the given String has a value that is not "".
static boolean isTerminating(String ch)
          Check if a given char is a terminating an URL.
static boolean isWhiteSpaceOrEmpty(String str)
          Returns TRUE if the String only cosists of whitespaces or is null / empty.
static String pointTrim(String str, int length, boolean escapeMnemonics)
          Trims the given String to the given length and appends "..."
static String printf(String str, String[] wildcard, String[] substitution)
          Substitute wildcards in a String and return it
static String replaceAll(String str, String search, String replace)
          This method does exactly the same as String.replaceAll() with the difference that no regular expressions are used to perform the replacement.
static String stripTags(String str)
          Remove HTML tags from the given String
static Vector toVector(String[] array)
          Create a Vector containing all Strings from the String array
static String unicodeToEntities(String str)
          Convert the non ASCII-characters of a String into Unicode HTML entities.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

AUTH_TOKENIZER

public static final String AUTH_TOKENIZER
Custom Tokenizer for Authentication Strings

See Also:
Constant Field Values

CAT_TOKENIZER

public static final String CAT_TOKENIZER
Custom Tokenizer for Category Path

See Also:
Constant Field Values
Constructor Detail

StringShop

private StringShop()
This utility class constructor is hidden

Method Detail

createAnchor

public static String createAnchor(String url)
Create a HTML anchor from the given URL.

Parameters:
url - The URL of the new anchor
Returns:
String A HTML anchor

createFileName

public static String createFileName(String str)
Create a valid filename from the given String.

Parameters:
str - The String to convert to a valid filename.
Returns:
String A valid filename.

hrTrim

public static String hrTrim(String str,
                            int limit)
Trim the given String to the given Limit. Make it human readable, such as it is tried to trim the text after a whitespace, in order to keep entire words.

Parameters:
str - The String to Trim
limit - The max. number of characters
Returns:
String The human readable trimmed String

isset

public static boolean isset(String str)
Returns TRUE in case the given String has a value that is not "".

Parameters:
str - The String to check
Returns:
boolean TRUE in case the String has an value not ""

isTerminating

public static boolean isTerminating(String ch)
Check if a given char is a terminating an URL. URL-terminating symbols are whitespaces, single- and double quotes.

Parameters:
ch - Any char
Returns:
TRUE if the char is terminating

isWhiteSpaceOrEmpty

public static boolean isWhiteSpaceOrEmpty(String str)
Returns TRUE if the String only cosists of whitespaces or is null / empty.

Parameters:
str - The string to check
Returns:
boolean TRUE if the String only consists of whitespaces

pointTrim

public static String pointTrim(String str,
                               int length,
                               boolean escapeMnemonics)
Trims the given String to the given length and appends "..." Also replaces all occurances of "&" with "&&" if the String is used as title for controls that display "&" as mnemonic.

Parameters:
str - The String to Trim
length - The max. length of the String
escapeMnemonics - If TRUE all "&" will be replaced with "&&"
Returns:
String The trimmed String

printf

public static String printf(String str,
                            String[] wildcard,
                            String[] substitution)
Substitute wildcards in a String and return it

Parameters:
str - The String to format
wildcard - Array of wildcards
substitution - Array of wildcards for the substitution of the wildcards.
Returns:
String The formatted String

replaceAll

public static String replaceAll(String str,
                                String search,
                                String replace)
This method does exactly the same as String.replaceAll() with the difference that no regular expressions are used to perform the replacement.

Parameters:
str - The source String to search and replace
search - The search term that should get replaced
replace - The value that replaces the search term
Returns:
String The new String with all replaced search terms

stripTags

public static String stripTags(String str)
Remove HTML tags from the given String

Parameters:
str - The String to remove the Tags from
Returns:
String The Tag removed String

toVector

public static Vector toVector(String[] array)
Create a Vector containing all Strings from the String array

Parameters:
array - The array to convert to a Vector
Returns:
Vector Containing all Strings from the Array

unicodeToEntities

public static String unicodeToEntities(String str)
Convert the non ASCII-characters of a String into Unicode HTML entities.

Parameters:
str - The String to convert
Returns:
String The converted String


RSSOwl - RSS / RDF / Atom Newsreader

SourceForge.net Logo