org.openptk.util
Class StringUtil
java.lang.Object
org.openptk.util.StringUtil
public final class StringUtil
- extends java.lang.Object
- Author:
- Scott Fehrman
Method Summary |
static java.lang.String |
arrayToString(java.lang.String[] array)
Converts the String Array to a String. |
static java.lang.String |
clean(java.lang.String characters,
java.lang.String in)
Clean the "input" String so that is only contains the characters
specified. |
static void |
main(java.lang.String[] args)
|
static java.lang.String[] |
stringToArray(java.lang.String string,
java.lang.String token)
Process the String into a String Array
Not using String.split because we want to handle "empty/blank" sub-strings
The array will not contain empty strings, they will be skipped
The returned String Array will always be non-null, may have zero elements. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ALPHA_NUM
public static final java.lang.String ALPHA_NUM
- See Also:
- Constant Field Values
ALPHA_NUM_SPACE
public static final java.lang.String ALPHA_NUM_SPACE
- See Also:
- Constant Field Values
BASIC_JDBC
public static final java.lang.String BASIC_JDBC
- See Also:
- Constant Field Values
BASIC_WEB
public static final java.lang.String BASIC_WEB
- See Also:
- Constant Field Values
arrayToString
public static java.lang.String arrayToString(java.lang.String[] array)
- Converts the String Array to a String.
The returned String will begin with the "[" character.
Each array item will start and end with a single quote "'".
If there is more than one String in the array, a comma "," is placed
between items. The String will end with the "]" character.
- Parameters:
array
-
- Returns:
- String
clean
public static java.lang.String clean(java.lang.String characters,
java.lang.String in)
- Clean the "input" String so that is only contains the characters
specified.
- Parameters:
characters
- String of characters that are allowedin
- String containing the input data
- Returns:
- output String after cleaning
main
public static void main(java.lang.String[] args)
- Parameters:
args
- (not used)
stringToArray
public static java.lang.String[] stringToArray(java.lang.String string,
java.lang.String token)
- Process the String into a String Array
Not using String.split because we want to handle "empty/blank" sub-strings
The array will not contain empty strings, they will be skipped
The returned String Array will always be non-null, may have zero elements.
INPUT = "/hello/world//today/is/great" and TOKEN = "/"
converts to: [ "hello", "world", "today", "is", "great" ]
NOT to: [ "", "hello", "world", "", "today", "is", "great" ]
- Parameters:
string
- The String that will be parsedtoken
- The String that is used to separate / split the string into values
- Returns:
- String[] containing the parsed Strings from the input String
View/submit a bug or feature
For further API reference and developer documentation, see www.openptk.org.
That documentation contains more detailed, developer-targeted descriptions,
definitions of terms, workarounds, and working code examples.
Copyright (C) 2008-2012, Project OpenPTK. All Rights Reserved