public class StringUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static int |
countNL(String in)
Counts the number of
NL in the given in string. |
static int |
countOccurrences(String container,
String content)
Counts how many times
content appears within container
without string overlapping. |
static String |
escapeAsJSONString(String in)
Escapes the
in string as JSON string
to let it being embeddable within a string field. |
static String |
escapeDoubleQuotes(String in)
Escapes all the unescaped double quotes when needed.
|
static boolean |
isPrefix(String candidatePrefix,
String container)
Check whether string
candidatePrefix is prefix of string container. |
static boolean |
isSuffix(String candidateSuffix,
String container)
Check whether string
candidateSuffix is suffix of string container. |
static String |
join(String delimiter,
String... data)
Joins the given input sting
data list
using the specified delimiter. |
static String |
multiply(char c,
int times)
Builds a string composed of the given char
c |
public static String join(String delimiter, String... data)
data list
using the specified delimiter.delimiter - string delimiter.data - list of data to be joined.public static int countOccurrences(String container, String content)
content appears within container
without string overlapping.container - container string.content - content string.public static int countNL(String in)
NL in the given in string.in - input string.public static boolean isPrefix(String candidatePrefix, String container)
candidatePrefix is prefix of string container.candidatePrefix - container - true if candidatePrefix is prefix of container,
false otherwise.public static boolean isSuffix(String candidateSuffix, String container)
candidateSuffix is suffix of string container.candidateSuffix - container - true if candidateSuffix is prefix of container,
false otherwise.public static String escapeDoubleQuotes(String in)
in - input string.public static String escapeAsJSONString(String in)
in string as JSON string
to let it being embeddable within a string field.in - string to be escaped.public static String multiply(char c, int times)
c n times.c - char to be multiplied.times - number of times.Copyright © 2010-2013 The Apache Software Foundation. All Rights Reserved.