public final class StringUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static String |
formatHtml(String source,
boolean bReplaceNl,
boolean bReplaceTag,
boolean bReplaceQuote)
This method is used to insert HTML block dynamically.
|
static String |
pad(String src,
char padChar,
boolean rightPad,
int totalLength)
Pad string object.
|
static String |
replaceString(String source,
Map<String,Object> args)
Replace strings using placeholders.
|
static String |
replaceString(String source,
Object[] args)
Replace strings using placeholders.
|
static String |
replaceString(String source,
String oldStr,
String newStr)
This is a string replacement method.
|
static byte[] |
toByteArray(String hexString)
Get byte array from hex string.
|
static String |
toHexString(byte[] res)
Get hex string from byte array.
|
public static String replaceString(String source, String oldStr, String newStr)
source - The original stringoldStr - The substring to replacenewStr - The replacement stringpublic static String replaceString(String source, Object[] args)
replaceString( "This {} a {}", ["is', "string"])"This is a string"source - The original stringargs - The array of object to replace the placeholders in
the original stringpublic static String replaceString(String source, Map<String,Object> args)
replaceString( "This {} a {}", Map("is', "string"))"This is a string"source - The original stringargs - The map of object to replace the placeholders in
the original stringpublic static String formatHtml(String source, boolean bReplaceNl, boolean bReplaceTag, boolean bReplaceQuote)
source - the HTML code to be processesbReplaceNl - if true '\n' will be replaced by bReplaceTag - if true '<' will be replaced by < and
'>' will be replaced by >bReplaceQuote - if true '\"' will be replaced by "public static String pad(String src, char padChar, boolean rightPad, int totalLength)
public static String toHexString(byte[] res)
public static byte[] toByteArray(String hexString)
Copyright © 2003–2025 The Apache Software Foundation. All rights reserved.