nl.gx.webmanager.handler.util
Class TextUtil

java.lang.Object
  extended by nl.gx.webmanager.handler.util.TextUtil

public class TextUtil
extends java.lang.Object

Various static String manipulation methods.


Constructor Summary
TextUtil()
           
 
Method Summary
static java.lang.String appendRequestParameter(java.lang.String baseUrl, java.lang.String key, java.lang.String value, java.lang.String encoding)
           
static java.lang.String[] extractTokens(java.lang.String source, java.lang.String startDelimiter, java.lang.String endDelimiter, boolean ignoreCase)
          Extracts all tokens from a source that are enclosed by the specified start and enddelimiter.
static java.lang.String filter(java.lang.String source, java.lang.String startDelimiter, java.lang.String endDelimiter)
          Filters the parts starting with the startDelimiter and ending with the endDelimiter from a string.
static java.lang.String join(java.lang.Object[] values, java.lang.String delimiter)
          Concatenates the elements of an array to a String.
static java.lang.String replace(java.lang.String original, java.lang.String token, java.lang.String replacement)
           
static java.lang.String[] split(java.lang.String string, char splitter)
          Returns A array of the non-empty string tokens in the source.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TextUtil

public TextUtil()
Method Detail

extractTokens

public static java.lang.String[] extractTokens(java.lang.String source,
                                               java.lang.String startDelimiter,
                                               java.lang.String endDelimiter,
                                               boolean ignoreCase)
Extracts all tokens from a source that are enclosed by the specified start and enddelimiter.
 $
 values = "pom pom <L>Link</L> en <L>link2</l> tralala.";
 $
 $%extractTokens(values, "<L>", "</L>", false)%$
 $%extractTokens(values, "<L>", "</L>", true)%$
 Output - [Link][Link, link2]
 

Parameters:
source - The source from which the tokens should be extacted
startDelimiter - The start delimiter for the requested tokens
endDelimiter - The end delimiter for the requested tokens
ignoreCase - Indicates whether matching of delimiters should be case sensitive
Returns:
The array of all tokens that are found between the delimiters in the source

filter

public static java.lang.String filter(java.lang.String source,
                                      java.lang.String startDelimiter,
                                      java.lang.String endDelimiter)
Filters the parts starting with the startDelimiter and ending with the endDelimiter from a string.

Parameters:
source - The original string
startDelimiter - The start tag of the parts that should be filtered
endDelimiter - The end tag of the parts that be filtered
Returns:
The original string from which the parts have been removed

split

public static java.lang.String[] split(java.lang.String string,
                                       char splitter)
Returns A array of the non-empty string tokens in the source.

Parameters:
string - The source that should be splitted into tokens
splitter - The char that should be used as delimiter
Returns:
The array of string tokens in the source

join

public static java.lang.String join(java.lang.Object[] values,
                                    java.lang.String delimiter)
Concatenates the elements of an array to a String.
 
Example: print(join(elements,"+")); Output - text1+text2+text3+text4

Parameters:
values - The values that should be joined
delimiter - The String that is placed between the elements
Returns:
A string containing all elements separated by the delimter

replace

public static java.lang.String replace(java.lang.String original,
                                       java.lang.String token,
                                       java.lang.String replacement)

appendRequestParameter

public static java.lang.String appendRequestParameter(java.lang.String baseUrl,
                                                      java.lang.String key,
                                                      java.lang.String value,
                                                      java.lang.String encoding)
                                               throws java.io.UnsupportedEncodingException
Throws:
java.io.UnsupportedEncodingException


Copyright © 2007-2011 GX Software BV. All Rights Reserved.