public class StringUtils extends Object
| Constructor and Description |
|---|
StringUtils() |
| Modifier and Type | Method and Description |
|---|---|
static String |
concatLines(List<String> lines)
Returns a concatenated string consisting of the given lines seperated by a new line character \n.
|
static String |
decodeUrl(String stringToDecode)
URL-Decodes a given string using UTF-8.
|
static String |
decodeUrlIso(String stringToDecode)
URL-Decodes a given string using ISO-8859-1.
|
static String |
ellipsize(String text,
int maxLength)
Cuts the string at the end if it's longer than maxLength and appends "..." to it.
|
static String |
encodeUrl(String stringToEncode)
URL-Encodes a given string using UTF-8 (some web pages have problems with UTF-8 and umlauts, consider
encodeUrlIso(String) also). |
static String |
encodeUrlIso(String stringToEncode)
URL-encodes a given string using ISO-8859-1, which may work better with web pages and umlauts compared to UTF-8.
|
static String[] |
fastSplit(String string,
char delimiter)
Splits a String based on a single character, which is usually faster than regex-based String.split().
|
static List<String> |
findLinesContaining(String text,
String searchText) |
static String |
generateDigestString(String stringToEncode,
String digestAlgo,
String encoding,
int lengthToPad) |
static String |
generateMD5String(String stringToEncode)
Generates the MD5 digest for a given String based on UTF-8.
|
static String |
generateSHA1String(String stringToEncode)
Generates the SHA-1 digest for a given String based on UTF-8.
|
static String |
joinArrayOnComma(int[] array) |
static String |
joinArrayOnComma(String[] array) |
static String |
joinIterableOnComma(Iterable<?> iterable) |
static String |
resolveEntity(String entity)
Simple HTML/XML entity resolving: Only supports unicode enitities and a very limited number text represented
entities (apos, quot, gt, lt, and amp).
|
static String[] |
splitLines(String text,
boolean skipEmptyLines) |
static String |
toHexString(byte[] bytes,
int lengthToPad) |
public static String[] fastSplit(String string, char delimiter)
public static String encodeUrl(String stringToEncode)
encodeUrlIso(String) also). No UnsupportedEncodingException to handle as it is dealt with in this
method.public static String encodeUrlIso(String stringToEncode)
public static String decodeUrl(String stringToDecode)
public static String decodeUrlIso(String stringToDecode)
public static String generateMD5String(String stringToEncode)
public static String generateSHA1String(String stringToEncode)
public static String generateDigestString(String stringToEncode, String digestAlgo, String encoding, int lengthToPad)
public static String toHexString(byte[] bytes, int lengthToPad)
public static String resolveEntity(String entity)
entity - The entity name without & and ; (null throws NPE)public static String ellipsize(String text, int maxLength)
public static String concatLines(List<String> lines)
public static String joinArrayOnComma(int[] array)
Copyright © 2016. All rights reserved.