org.deegree_impl.tools
Class StringExtend

java.lang.Object
  extended byorg.deegree_impl.tools.StringExtend

public class StringExtend
extends java.lang.Object

this is a collection of some methods that extends the functionallity of the sun-java string class.


Constructor Summary
StringExtend()
           
 
Method Summary
static java.lang.String arrayToString(double[] s, char delimiter)
          transforms a double array to one string. the array fields are seperated by the submitted delimiter:
static java.lang.String arrayToString(int[] s, char delimiter)
          transforms a int array to one string. the array fields are seperated by the submitted delimiter:
static java.lang.String arrayToString(java.lang.String[] s, char delimiter)
          transforms a string array to one string. the array fields are seperated by the submitted delimiter:
static boolean contains(java.lang.String[] target, java.lang.String value)
          checks if the submitted array contains the string value
static int countString(java.lang.String target, java.lang.String token)
          countString count the occurrences of token into target
static java.lang.String[] deleteDoubles(java.lang.String[] s)
          deletes all double entries from the submitted array
static java.lang.String extractArray(java.lang.String target, java.lang.String startDel, java.lang.String endDel, boolean delStart, boolean delEnd)
          extract a string contained between startDel and endDel, you can remove t he delimiters if set true the parameters delStart and delEnd
static java.lang.String[] extractString(java.lang.String target, java.lang.String startString, java.lang.String end)
          Extract all the string that begin with "start" and end with "end" and store it into an array of String
static java.lang.String HTMLEncode(java.lang.String source)
          replaces all special german letters (umlaute) draft version
static java.lang.String[] removeFromArray(java.lang.String[] target, java.lang.String s)
          removes all fields from the array that equals s
static java.lang.String replace(java.lang.String target, java.lang.String from, java.lang.String to, boolean all)
          replaces occurences of a string fragment within a string by a new string.
static java.lang.String stackTraceToString(java.lang.StackTraceElement[] se)
          transforms an array of StackTraceElements into a String
static java.lang.String[] toArray(java.lang.String s, java.lang.String delimiter, boolean deleteDoubles)
          parse a string and return its tokens as array
static double[] toArrayDouble(java.lang.String s, java.lang.String delimiter)
          convert the array of string like [(x1,y1),(x2,y2)...] into an array of double [x1,y1,x2,y2...]
static java.lang.String validateString(java.lang.String s, java.lang.String mark)
          clears the begin and end of a string from the strings sumitted
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StringExtend

public StringExtend()
Method Detail

replace

public static java.lang.String replace(java.lang.String target,
                                       java.lang.String from,
                                       java.lang.String to,
                                       boolean all)
replaces occurences of a string fragment within a string by a new string.

Parameters:
target - is the original string
from - is the string to be replaced
to - is the string which will used to replace
all - if it's true all occurences of the string to be replaced will be replaced. else only the first occurence will be replaced.

HTMLEncode

public static java.lang.String HTMLEncode(java.lang.String source)
replaces all special german letters (umlaute) draft version


toArray

public static java.lang.String[] toArray(java.lang.String s,
                                         java.lang.String delimiter,
                                         boolean deleteDoubles)
parse a string and return its tokens as array

Parameters:
s - string to parse
delimiter - delimiter that marks the end of a token
deleteDoubles - if it's true all string that are already within the resulting array will be deleted, so that there will only be one copy of them.

arrayToString

public static java.lang.String arrayToString(java.lang.String[] s,
                                             char delimiter)
transforms a string array to one string. the array fields are seperated by the submitted delimiter:

Parameters:
s - stringarray to transform
delimiter -

arrayToString

public static java.lang.String arrayToString(double[] s,
                                             char delimiter)
transforms a double array to one string. the array fields are seperated by the submitted delimiter:

Parameters:
s - stringarray to transform
delimiter -

arrayToString

public static java.lang.String arrayToString(int[] s,
                                             char delimiter)
transforms a int array to one string. the array fields are seperated by the submitted delimiter:

Parameters:
s - stringarray to transform
delimiter -

validateString

public static java.lang.String validateString(java.lang.String s,
                                              java.lang.String mark)
clears the begin and end of a string from the strings sumitted

Parameters:
s - string to validate
mark - string to remove from begin and end of s

deleteDoubles

public static java.lang.String[] deleteDoubles(java.lang.String[] s)
deletes all double entries from the submitted array


removeFromArray

public static java.lang.String[] removeFromArray(java.lang.String[] target,
                                                 java.lang.String s)
removes all fields from the array that equals s

Parameters:
target - array where to remove the submitted string
s - string to remove

contains

public static boolean contains(java.lang.String[] target,
                               java.lang.String value)
checks if the submitted array contains the string value

Parameters:
target - array to check if it contains value
value - string to check if it within the array

countString

public static int countString(java.lang.String target,
                              java.lang.String token)
countString count the occurrences of token into target

Parameters:
target -
token -
Returns:

extractString

public static java.lang.String[] extractString(java.lang.String target,
                                               java.lang.String startString,
                                               java.lang.String end)
Extract all the string that begin with "start" and end with "end" and store it into an array of String

Parameters:
target -
startString -
end -
Returns:

extractArray

public static java.lang.String extractArray(java.lang.String target,
                                            java.lang.String startDel,
                                            java.lang.String endDel,
                                            boolean delStart,
                                            boolean delEnd)
extract a string contained between startDel and endDel, you can remove t he delimiters if set true the parameters delStart and delEnd

Parameters:
target -
startDel -
endDel -
delStart -
delEnd -
Returns:

toArrayDouble

public static double[] toArrayDouble(java.lang.String s,
                                     java.lang.String delimiter)
convert the array of string like [(x1,y1),(x2,y2)...] into an array of double [x1,y1,x2,y2...]

Parameters:
s -
delimiter -
Returns:

stackTraceToString

public static java.lang.String stackTraceToString(java.lang.StackTraceElement[] se)
transforms an array of StackTraceElements into a String