org.apache.pluto.util
Class StringUtils

java.lang.Object
  extended by org.apache.pluto.util.StringUtils

public class StringUtils
extends Object

Static class hosting a couple of utility methods around strings.


Method Summary
static String[] copy(String[] source)
          TODO: can't we just use String[].clone()?
static Map copyParameters(Map parameters)
          Deep-clones a parameter map.
static String getMimeTypeWithoutEncoding(String mimeType)
          Strips the specified mime type by removing the character encoding specified at the end of the mime type (all characters after the ';').
static String replace(String source, String pattern, String replace)
          Replaces all occurrences of a pattern within a string by a replacement.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

replace

public static String replace(String source,
                             String pattern,
                             String replace)
Replaces all occurrences of a pattern within a string by a replacement.

Parameters:
source - the string that should be searched.
pattern - the pattern that should be replaced.
replace - the replacement that should be inserted instead of the pattern.
Returns:
The updated source string.

copy

public static String[] copy(String[] source)
TODO: can't we just use String[].clone()?

Parameters:
source -
Returns:

copyParameters

public static Map copyParameters(Map parameters)
Deep-clones a parameter map. The key is the parameter name as a String instance, while the value is a String array (String[]) instance.

Parameters:
parameters - the parameter map to deep-clone.
Returns:
the deep-cloned parameter map.

getMimeTypeWithoutEncoding

public static String getMimeTypeWithoutEncoding(String mimeType)
Strips the specified mime type by removing the character encoding specified at the end of the mime type (all characters after the ';'). The stripped mime type is trimmed string which contains no white spaces at the beginning and the end.

Parameters:
mimeType - the mime type to strip.
Returns:
the stripped mime type.


Copyright © 2003-2011 Apache Software Foundation. All Rights Reserved.