com.filenet.wcm.toolkit.server.util
Class WcmStringEditor

java.lang.Object
  extended bycom.filenet.wcm.toolkit.server.util.WcmStringEditor

public class WcmStringEditor
extends java.lang.Object

WcmStringEditor provides static utility functions for manipulating strings, supplementing the functionality in JDK.


Method Summary
static java.lang.String catPathParts(java.lang.String part1, java.lang.String part2, java.lang.String separator)
          Concatenate two strings representing parts fo a path.
static java.lang.String encode(java.lang.String str)
          Deprecated. use WcmEncodingUtil.encodeURL method URL-Encodes input string. If the string is null, returns ""
static java.lang.String replace(java.lang.String str, java.lang.String replace, java.lang.String with, boolean all)
          Perform a replace operation on a String.
static java.lang.String right(java.lang.String str, int length)
          Return the rightmost portion of a string.
static java.lang.String[] tokenizeToArray(java.lang.String str, java.lang.String delim)
          Tokenize a string based on the specified delimiter, into an array of tokens.
static java.lang.String trim(java.lang.String str, char c)
          Trims character c from the beginning and end of the string str.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

catPathParts

public static java.lang.String catPathParts(java.lang.String part1,
                                            java.lang.String part2,
                                            java.lang.String separator)
Concatenate two strings representing parts fo a path. Checks to make sure that one and only one path separator is between the two parts. If one of the parts is null, then the non-null part is returned.

Parameters:
part1 -
part2 -
separator - - Default is "/" if null is specified.
Returns:

replace

public static java.lang.String replace(java.lang.String str,
                                       java.lang.String replace,
                                       java.lang.String with,
                                       boolean all)
Perform a replace operation on a String.

Parameters:
str - The String to perform the replace on.
replace - The pattern to replace.
with - The String to replace it with.
all - Set to true to replace all occurences, otherwise, only the first occurence is replaced.
Returns:
The edited String.

tokenizeToArray

public static java.lang.String[] tokenizeToArray(java.lang.String str,
                                                 java.lang.String delim)
Tokenize a string based on the specified delimiter, into an array of tokens.

Parameters:
str - The String to tokenize.
delim - The delimiter to use.
Returns:
An array of String tokens.

right

public static java.lang.String right(java.lang.String str,
                                     int length)
Return the rightmost portion of a string.

Parameters:
str - The String to get the rightmost portion of.
length - The number of characters to get.
Returns:
A String of the specified number of rightmost characters, or the whole string if str is shorter than length.

trim

public static java.lang.String trim(java.lang.String str,
                                    char c)
Trims character c from the beginning and end of the string str.

Parameters:
str -
c -

encode

public static java.lang.String encode(java.lang.String str)
Deprecated. use WcmEncodingUtil.encodeURL method URL-Encodes input string. If the string is null, returns ""

Parameters:
str - String needs to be encoded.
Returns:
URL-Encoded String


© Copyright IBM Corp. 2002, 2007. All Rights Reserved.