net.sf.ooweb.util
Class StringUtils

java.lang.Object
  extended by net.sf.ooweb.util.StringUtils

public final class StringUtils
extends java.lang.Object

StringUtils

Since:
Jul 23, 2005
Author:
R. Rawson-Tetley, Darren Davison

Method Summary
static java.lang.String decodeURLEncoding(java.lang.String s)
          Takes a URL-encoded string and decodes it.
static java.lang.String encodeURL(java.lang.String s)
          Performs URL encoding of a string
static java.lang.String generateUUID()
          Type 1 (time-based) Pure-Java UUID Generator This has the advantage of not using SecureRandom (being time-based) and is therefore fast.
static java.lang.String replace(java.lang.String inString, java.lang.String oldPattern, java.lang.String newPattern)
          Replace all occurences of a substring within a string with another string.
static java.lang.String[] split(java.lang.String splitstring, java.lang.String splitchar)
          Splits a string by a particular char and returns an array of strings.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

generateUUID

public static java.lang.String generateUUID()
Type 1 (time-based) Pure-Java UUID Generator This has the advantage of not using SecureRandom (being time-based) and is therefore fast. Note that it uses the hostname and a some random entropy to construct a node rather than the ethernet MAC address (to keep it pure java). Despite this limitation, it should still produce very good, unique UUIDs since the mix of hostname/randomness and UTC since the epoch down to the millisecond should be good enough for most applications. The output format is a UUID URN according to the IETF draft, which you can find here: http://www.ietf.org/internet-drafts/draft-mealling-uuid-urn-03.txt


split

public static java.lang.String[] split(java.lang.String splitstring,
                                       java.lang.String splitchar)
Splits a string by a particular char and returns an array of strings. If there are no occurrences of the split char, the original string is returned in an array of 1 item.

Parameters:
splitstring - The string to be split
splitchar - The char to split on
Returns:
An array of strings

replace

public static java.lang.String replace(java.lang.String inString,
                                       java.lang.String oldPattern,
                                       java.lang.String newPattern)
Replace all occurences 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

decodeURLEncoding

public static java.lang.String decodeURLEncoding(java.lang.String s)
Takes a URL-encoded string and decodes it.

Parameters:
s - A URL encoded string
Returns:
The decoded string

encodeURL

public static java.lang.String encodeURL(java.lang.String s)
Performs URL encoding of a string

Parameters:
s -
Returns:
The encoded string


Copyright (C) 2005-2007 OOWeb Authors.