public class StringExtensions extends Object
| Constructor and Description |
|---|
StringExtensions() |
| Modifier and Type | Method and Description |
|---|---|
static String |
addDoubleQuotationMarks(String s)
Puts to the given String at the start and end quotes.
|
static String |
addSingleQuotationMarks(String s)
Puts to the given String at the start and end quotes.
|
static byte[] |
convertToBytearray(char[] source)
Converts the given chararray to a bytearray.
|
static char[] |
convertToCharArray(byte[] source)
Convert the given byte array to char array.
|
static Character |
convertUnicodeStringToCharacter(String theUnicodeString)
Converts the given unicode String object to character object.
|
static byte[] |
decodeHex(char[] data)
Decode hex.
|
static char[] |
encodeHex(byte[] data)
Encode hex.
|
static String |
firstCharacterToLowerCase(String fieldName)
Sets the first character from the given string to lower case and returns it.
|
static String |
firstCharacterToUpperCase(String fieldName)
Sets the first character from the given string to upper case and returns it.
|
static String |
getAttributName(String name)
Gets the Attribut-name without brackets.
|
static String |
getIndex(String name)
Gets the first index from the brackets.
|
static String |
getItemNumber(String name)
Gets the ItemNumber from the String name.
|
static String |
getStringAfterUnderscore(String element)
The Method getStringAfterUnderscore(String) gets the substring after the first underscore.
|
static String |
getStringBeforeUnderscore(String element)
The Method getStringBeforeUnderscore(String) gets the substring before the first underscore.
|
static String |
getValue(Map<String,String> data,
String key,
String defaultValue)
Gets the value from the given map and if it does not exist or is empty the given default
value will be returned.
|
static boolean |
isNullOrEmpty(String str)
The method isNullOrEmpty(String) checks if the given String is empty or null.
|
static boolean |
isNumber(String testString)
Checks if the given String is an Number.
|
static String |
lastCharacter(String str)
Gets the last character of the given String object.
|
static String |
readLine(String stringWithCarriageReturns)
Reads the given String till it finds a carriage return and returns it.
|
static String[] |
removeEmptyString(String[] words)
Removes empty Strings from the given string array and gives it back.
|
static String |
removeNewlineCharacters(String subject)
Removes the newline characters from the given String.
|
static String |
removeQuotationMarks(String s)
Removes from the given String at the start and end quotes.
|
static String |
replaceAll(String original,
String[] findString,
String replaceWith)
Replaces all occurrences of a String within another String.
|
static String |
replaceAll(String original,
String findString,
String replaceWith)
Replaces all occurrences of a String within another String.
|
static String |
replaceEach(String input,
String searchRegexPattern,
String replace)
Replace each occurences from the search pattern(regex) with the given replace String of the
given input String.
|
static String |
replaceLast(String original,
String findString,
String replacement)
Replaces the last occurrence of a String within another String.
|
static String |
toUnicode(String toUnicode,
boolean toLowerCase)
Converts all characters from the given String to unicodes characters encoded like \uxxxx.
|
static String |
toUnicodeChars(String s,
boolean toLowerCase)
Converts all characters from the given String to unicodes characters encoded like \uxxxx.
|
public static final String addDoubleQuotationMarks(String s)
s - The String to handle.public static final String addSingleQuotationMarks(String s)
s - The String to handle.public static final String firstCharacterToLowerCase(String fieldName)
fieldName - The String to modify.public static final String firstCharacterToUpperCase(String fieldName)
fieldName - The String to modify.public static final boolean isNullOrEmpty(String str)
str - The String to check.public static final boolean isNumber(String testString)
testString - The String to check.public static String lastCharacter(String str)
str - the strpublic static final String removeQuotationMarks(String s)
s - The String to handle.public static final String replaceLast(String original, String findString, String replacement)
original - The String to search.findString - The search pattern.replacement - Replace with that String.public static String toUnicode(String toUnicode, boolean toLowerCase)
toUnicode - The String to convert.toLowerCase - If true the letters from the unicode characters are lower case.public static String toUnicodeChars(String s, boolean toLowerCase)
s - The String to convert.toLowerCase - If true the letters from the unicode characters are lower case.public static final byte[] convertToBytearray(char[] source)
source - the source.public static char[] convertToCharArray(byte[] source)
source - the source.public static Character convertUnicodeStringToCharacter(String theUnicodeString)
theUnicodeString - the the unicode stringpublic static byte[] decodeHex(char[] data)
throws org.apache.commons.codec.DecoderException
data - the dataorg.apache.commons.codec.DecoderException - the decoder exceptionpublic static char[] encodeHex(byte[] data)
data - the datapublic static final String getAttributName(String name)
name - The name with brackets.public static final String getIndex(String name)
name - The name from the Attributepublic static final String getItemNumber(String name)
name - the namepublic static final String getStringAfterUnderscore(String element)
element - The element to get the substing.public static final String getStringBeforeUnderscore(String element)
element - The element to get the substing.public static String getValue(Map<String,String> data, String key, String defaultValue)
data - the datakey - the keydefaultValue - the default valuepublic static final String readLine(String stringWithCarriageReturns)
stringWithCarriageReturns - The String.public static String[] removeEmptyString(String[] words)
words - The string array to remove empty strings.public static String removeNewlineCharacters(String subject)
subject - the subjectpublic static final String replaceAll(String original, String findString, String replaceWith)
original - The String to search.findString - The search pattern.replaceWith - Replace with that String.public static final String replaceAll(String original, String[] findString, String replaceWith)
original - The String to search.findString - An array with search patterns.replaceWith - Replace with that String.public static String replaceEach(String input, String searchRegexPattern, String replace)
input - the input String that will be changed.searchRegexPattern - the search regex patternreplace - the String to replace with.Copyright © 2015–2016 Alpha Ro Group UG (haftungsbeschrÀngt). All rights reserved.