Package com.dtolabs.rundeck.core.utils
Class TextUtils
- java.lang.Object
-
- com.dtolabs.rundeck.core.utils.TextUtils
-
public class TextUtils extends java.lang.Object
Join/split and escape/unescape strings
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
TextUtils.Partial
A partial unescape result
-
Constructor Summary
Constructors Constructor Description TextUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.String
escape(java.lang.String input, char echar, char[] special)
Escape the input string using the escape delimiter for the given special charsstatic java.lang.String
join(java.lang.String[] input, char separator)
Join an array of strings with the given separator, without escapingstatic java.lang.String
joinEscaped(java.lang.String[] input, char separator, char echar, char[] special)
Join an array of strings with the given separator, escape char, and other special chars for escapingstatic java.lang.String[]
splitUnescape(java.lang.String input, char[] separators, char echar, char[] special)
Split the input on the given separator char, and unescape each portion using the escape char and special charsstatic java.lang.String[]
splitUnescape(java.lang.String input, char separator, char echar, char[] special)
Split the input on the given separator char, and unescape each portion using the escape char and special charsstatic java.lang.String
unescape(java.lang.String input, char echar, char[] allowEscaped)
Unescape the input string by removing the escape char for allowed charsstatic TextUtils.Partial
unescape(java.lang.String input, char echar, char[] allowEscaped, char[] delimiter)
Unescape the input string by removing the escape char for allowed chars
-
-
-
Method Detail
-
escape
public static java.lang.String escape(java.lang.String input, char echar, char[] special)
Escape the input string using the escape delimiter for the given special chars- Parameters:
input
- input stringechar
- escape charspecial
- all chars that should be escaped, the escape char itself will be automatically included- Returns:
- escaped string
-
unescape
public static java.lang.String unescape(java.lang.String input, char echar, char[] allowEscaped)
Unescape the input string by removing the escape char for allowed chars- Parameters:
input
- input stringechar
- escape charallowEscaped
- all chars that can be escaped by the escape char- Returns:
- unescaped string
-
unescape
public static TextUtils.Partial unescape(java.lang.String input, char echar, char[] allowEscaped, char[] delimiter)
Unescape the input string by removing the escape char for allowed chars- Parameters:
input
- input stringechar
- escape charallowEscaped
- all chars that can be escaped by the escape chardelimiter
- all chars that indicate parsing should stop- Returns:
- partial unescape result
-
join
public static java.lang.String join(java.lang.String[] input, char separator)
Join an array of strings with the given separator, without escaping- Parameters:
input
- input stringseparator
- separator- Returns:
- joined string
-
joinEscaped
public static java.lang.String joinEscaped(java.lang.String[] input, char separator, char echar, char[] special)
Join an array of strings with the given separator, escape char, and other special chars for escaping- Parameters:
input
- input stringseparator
- separatorechar
- escape charspecial
- all special chars not necessarily including the echar or separator- Returns:
- joined string
-
splitUnescape
public static java.lang.String[] splitUnescape(java.lang.String input, char separator, char echar, char[] special)
Split the input on the given separator char, and unescape each portion using the escape char and special chars- Parameters:
input
- input stringseparator
- char separating each componentechar
- escape charspecial
- chars that are escaped- Returns:
- results
-
splitUnescape
public static java.lang.String[] splitUnescape(java.lang.String input, char[] separators, char echar, char[] special)
Split the input on the given separator char, and unescape each portion using the escape char and special chars- Parameters:
input
- input string with components separated by the the separator charsseparators
- chars separating each componentechar
- escape charspecial
- additional chars that are escaped, does not need to include echar or separators- Returns:
- the unescaped components of the input
-
-