public class StringUtils
extends java.lang.Object
Constructor and Description |
---|
StringUtils() |
Modifier and Type | Method and Description |
---|---|
static int |
countFor(java.lang.String string,
java.lang.String toFind)
Counts the number of occurrences of a string within another,
same as
countFor(String,String,boolean) with ignoreCase as true |
static int |
countFor(java.lang.String string,
java.lang.String toFind,
boolean ignoreCase)
Counts the number of occurrences of a string within another
|
static java.util.List<java.lang.String> |
getStringsFromStream(java.io.InputStream stream)
Creates a list from an input stream where each entry is due to a new line character
|
static java.lang.String |
repeatChar(char character,
int amount)
Gets a string with the provided amount of the provided character
|
static java.lang.String |
repeatString(java.lang.String string,
int amount)
Gets a string with the provided amount of the provided string
|
static java.lang.String |
replaceAllPreservingCase(java.lang.String string,
java.lang.String toReplace,
java.lang.String toReplaceWith)
Replaces all instances of a string with another, preserving the case for each character
|
static java.lang.String |
replaceFirstPreservingCase(java.lang.String string,
java.lang.String toReplace,
java.lang.String toReplaceWith)
Replaces the first instance of a string with another, preserving the case for each character
|
static java.lang.String |
stringFromList(java.util.List list)
Converts (any) list into a string, useful with the
WebUtils.readURL(String) method |
public static java.lang.String stringFromList(java.util.List list)
WebUtils.readURL(String)
methodlist
- The listpublic static java.lang.String repeatChar(char character, int amount)
character
- Character for the stringamount
- Amount for the character to be repeatedpublic static java.lang.String repeatString(java.lang.String string, int amount)
string
- String to repeatamount
- Amount for the character to be repeatedpublic static java.util.List<java.lang.String> getStringsFromStream(java.io.InputStream stream) throws java.io.IOException
stream
- The input streamjava.io.IOException
public static int countFor(java.lang.String string, java.lang.String toFind, boolean ignoreCase)
string
- The string to look intoFind
- The string to look forignoreCase
- Whether to ignore casepublic static int countFor(java.lang.String string, java.lang.String toFind)
countFor(String,String,boolean)
with ignoreCase as truestring
- The string to look intoFind
- The string to look forpublic static java.lang.String replaceFirstPreservingCase(java.lang.String string, java.lang.String toReplace, java.lang.String toReplaceWith)
string
- The string to replace intoReplace
- The portion of the string to replacetoReplaceWith
- The string to replace withpublic static java.lang.String replaceAllPreservingCase(java.lang.String string, java.lang.String toReplace, java.lang.String toReplaceWith)
string
- The string to replace intoReplace
- The portion of the string to replacetoReplaceWith
- The string to replace with