public final class Strings2 extends Object
String utilities not provided by Strings.
| Modifier and Type | Method and Description |
|---|---|
static byte[] |
base64Decode(String theStringToDecode)
Base64 encodes the given byte array.
|
static String |
base64Encode(byte[] theArrayToEncode)
Base64 encodes the given byte array.
|
static String |
getRandomString(int theLength)
Return a string of random characters of the specified length.
|
static String |
hex(byte[] theArray)
Return the hex string value of the byte array
|
static byte[] |
md5(byte[] theBytes)
Returns the md5 representation of a string
|
static byte[] |
md5(String theString)
Returns the md5 representation of a string
|
static String |
toTitleCase(String theStr)
Convert a string to title case.
|
static String |
urlDecode(String theString)
URL decode the string using the UTF8 charset
|
static String |
urlDecode(String theString,
Charset theCharset)
URL decode the given string using the given Charset
|
static String |
urlEncode(String theString)
URL encode the string using the UTF8 charset
|
static String |
urlEncode(String theString,
Charset theCharset)
URL encode the given string using the given Charset
|
static String |
withoutLastCharacter(String s)
Returns the string that is one character shorter than the input string, without the last character.
|
static String |
withoutQuotes(String s)
If the input string starts and ends with either double quotes or single quote, it is truncated, otherwise the input string is returned
intact.
|
static String |
withoutTrailingSlash(String s)
If the input string ends with slash character "/", it is truncated, otherwise the input string is returned
intact.
|
public static String toTitleCase(String theStr)
theStr - the string to convertpublic static String hex(byte[] theArray)
theArray - the input arraypublic static byte[] md5(String theString)
theString - the string to md5public static byte[] md5(byte[] theBytes)
theBytes - the bytes to md5public static String getRandomString(int theLength)
theLength - the size of the random string to createpublic static String urlEncode(String theString)
theString - the string to encodepublic static String urlEncode(String theString, Charset theCharset)
theString - the string to encodetheCharset - the charset to encode the string usingpublic static String urlDecode(String theString)
theString - the string to decodepublic static String urlDecode(String theString, Charset theCharset)
theString - the string to decodetheCharset - the charset to decode the string usingpublic static String base64Encode(byte[] theArrayToEncode)
theArrayToEncode - the bytes to encodepublic static byte[] base64Decode(String theStringToDecode) throws IOException
theStringToDecode - the string to decodeIOException - throw if there is an error while decodingpublic static String withoutLastCharacter(String s)
IllegalArgumentException is thrown.public static String withoutTrailingSlash(String s)
Copyright © 2010-2016 Stardog Union. All Rights Reserved.