public class StringUtils extends Object
Constructor and Description |
---|
StringUtils()
Constructor method for i18n purposes only.
|
Modifier and Type | Method and Description |
---|---|
static String |
assembleTable(Object[][] array,
int spaces,
Character framechar)
Converts the given table data to aligned columns with a certain space.
|
static String |
safeReplaceAll(String text,
String regex,
String replacement)
Workaround for standard regex replacement method if string contains unallowed chars.
|
public StringUtils() throws InstantiationException
InstantiationException
- Error indicationpublic static String safeReplaceAll(String text, String regex, String replacement)
For instance the String.replaceAll()
method throws an exception if the string
to be replaced contains a dollar character ($) since this is interpreted as group. Make
sure that no %DOLLAR% substring is included since this is used ad intermediary.
This method should always be used if the replacement string may contain illegal group references (dollar characters: $).
text
- The text to be replacedregex
- The regular expressions to be replaced (all occurrences)replacement
- The replacements for the regular expressions, may contain unallowed charsNullPointerException
- If text
, regex
, or replacement
is null
java.util.regex.PatternSyntaxException
- If regex
is invalidpublic static String assembleTable(Object[][] array, int spaces, Character framechar)
array
- The array, toString()
is calledspaces
- The number of space characters between two columnsframechar
- Character to use for the header and footer lines (optional)NullPointerException
- If array
is null
Copyright © 2005-2024 Leisenfels GmbH. All rights reserved.