public final class StringUtils extends Object
Modifier and Type | Method and Description |
---|---|
static com.google.common.collect.ImmutableList<String> |
convertToHex(byte[] bytes)
Returns the given bytes in hex format.
|
static com.google.common.collect.ImmutableList<String> |
convertToHex(InputStream inputStream)
Returns the bytes of the given input stream in hex format.
|
static com.google.common.collect.ImmutableList<String> |
convertToHex(String string,
String charsetName)
Returns the bytes of the given string in hex format.
|
static byte[] |
getBytes(String string,
String charsetName)
Returns the bytes of the given string.
|
static com.google.common.collect.ImmutableList<Pair<String,String>> |
getTagAttributesAndContent(String string,
String openingTag,
String closingOfOpeningTag,
String closingTag)
For each tag, the tag attributes and the tag content are collected.
|
static String |
replace(String string,
String replacement,
int firstPosToReplace,
int lastPosToReplace)
Replaces a substring of the given string with some other string.
|
static String |
replaceTags(String string,
String openingTag,
String closingTag,
com.google.common.base.Function<String,String> replacementFunction)
For each tag, the tag is replaced with the content defined by the given replacement function.
|
static Pair<String,com.google.common.collect.ImmutableMap<String,Object>> |
replaceTags(String string,
String openingTag,
String closingOfOpeningTag,
String closingTag,
Function2<String,String,Pair<String,Map<String,Object>>> replacementFunction)
For each tag, the tag is replaced with the content defined by the given replacement function.
|
static com.google.common.collect.ImmutableList<String> |
toChunks(String string,
int chunkSize)
Splits the given string into chucks of characters of the given size.
|
static com.google.common.collect.ImmutableList<String> |
toLowerCase(List<String> input)
Converts the given strings to lower-case.
|
static String |
trimSuffix(String string,
String suffix)
Removes the given suffix from the given string.
|
public static com.google.common.collect.ImmutableList<Pair<String,String>> getTagAttributesAndContent(String string, String openingTag, String closingOfOpeningTag, String closingTag)
string
- the string to investigateopeningTag
- the opening tag to matchclosingOfOpeningTag
- the closing of the opening tag to matchclosingTag
- the closing tag to matchpublic static Pair<String,com.google.common.collect.ImmutableMap<String,Object>> replaceTags(String string, String openingTag, String closingOfOpeningTag, String closingTag, Function2<String,String,Pair<String,Map<String,Object>>> replacementFunction)
string
- the string to investigateopeningTag
- the opening tag to matchclosingOfOpeningTag
- the closing of the opening tag to matchclosingTag
- the closing tag to matchreplacementFunction
- the function to convert the tag into some new stringpublic static String replaceTags(String string, String openingTag, String closingTag, com.google.common.base.Function<String,String> replacementFunction)
string
- the string to investigateopeningTag
- the opening tag to matchclosingTag
- the closing tag to matchreplacementFunction
- the function to convert the tag into some new stringpublic static String replace(String string, String replacement, int firstPosToReplace, int lastPosToReplace)
string
- the string to investigatereplacement
- the replacement stringfirstPosToReplace
- the first position to replace in the stringlastPosToReplace
- the last position to replace in the stringpublic static String trimSuffix(String string, String suffix)
string
- the string to investigatesuffix
- the suffix to removepublic static com.google.common.collect.ImmutableList<String> toLowerCase(List<String> input)
input
- the string to covert to lower-casepublic static com.google.common.collect.ImmutableList<String> toChunks(String string, int chunkSize)
string
- the string to investigatechunkSize
- the chunk sizepublic static com.google.common.collect.ImmutableList<String> convertToHex(InputStream inputStream) throws IOException
inputStream
- the input stream whose bytes to convertIOException
- thrown if an error occurs while reading from the streampublic static com.google.common.collect.ImmutableList<String> convertToHex(String string, String charsetName)
string
- the string to convertcharsetName
- the charset to apply when converting the string to bytespublic static com.google.common.collect.ImmutableList<String> convertToHex(byte[] bytes)
bytes
- the bytes to convertCopyright © 2010 - 2018 edorasware ag. All Rights Reserved.