ro.isdc.wro.util
Class StringUtils

java.lang.Object
  extended by ro.isdc.wro.util.StringUtils

public final class StringUtils
extends Object

StringUtils Utility class. This class contains Utility methods for manipulating strings. Inspired from commons & spring.

Author:
Alex Objelean

Method Summary
static String cleanPath(String path)
          Normalize the path by suppressing sequences like "path/.." and inner simple dots.
static String collectionToDelimitedString(Collection<String> coll, String delim)
          Convenience method to return a Collection as a delimited (e.g.
static String normalizePath(String path)
          Normalize the path by removing occurrences of "..".
static String replace(String inString, String oldPattern, String newPattern)
          Replace all occurrences of a substring within a string with another string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

cleanPath

public static String cleanPath(String path)
Normalize the path by suppressing sequences like "path/.." and inner simple dots.

The result is convenient for path comparison. For other uses, notice that Windows separators ("\") are replaced by simple slashes.

Parameters:
path - the original path
Returns:
the normalized path

replace

public static String replace(String inString,
                             String oldPattern,
                             String newPattern)
Replace all occurrences of a substring within a string with another string.

Parameters:
inString - String to examine
oldPattern - String to replace
newPattern - String to insert
Returns:
a String with the replacements

collectionToDelimitedString

public static String collectionToDelimitedString(Collection<String> coll,
                                                 String delim)
Convenience method to return a Collection as a delimited (e.g. CSV) String. E.g. useful for toString() implementations.

Parameters:
coll - the Collection to display
delim - the delimiter to use (probably a ",")
Returns:
the delimited String

normalizePath

public static String normalizePath(String path)
Normalize the path by removing occurrences of "..".

Parameters:
path - to normalize.
Returns:
path string with double dots removed


Copyright © 2008-2011. All Rights Reserved.