|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object lumis.util.TextUtil
@StableMinor(version="5.5", sinceVersion="4.0") public class TextUtil
Utility methods for text-related operations.
Constructor Summary | |
---|---|
TextUtil()
|
Method Summary | |
---|---|
static void |
copyFile(String sourceFile,
String targetFile)
|
static String |
escapeJs(String javascriptString)
Escapes a javascript string so it can added to inside quotes without breaking the javascript code. |
static String |
escapeLocalizationParameter(String str)
Escapes a localization parameter string. |
static String |
escapeRegexpReplacement(String replacementString)
Escapes regexp replacement commands in a string for use as replacement. |
static FileWriter |
getFileWriter(String filename,
boolean append)
Deprecated. Since 4.0.9 because this method uses the system default charset encoding. |
static int |
indexOfCaseInsensitive(StringBuilder source,
String findStr)
|
static int |
indexOfCaseInsensitive(StringBuilder source,
String findStr,
int fromIndex)
|
static String |
joinStringArray(String[] array,
String delim)
|
static StringBuffer |
joinStringArray(String[] array,
String delim,
StringBuffer sb)
|
static String |
joinStringCollection(Collection<String> strings,
String delim)
Generates a string joining the strings in the collection with the delimiter specified between them. |
static String |
joinStringCollectionUserFriendly(List<String> listItems)
Build a list, separating terms with the locale-defined separator. |
static String |
leftPad(String s,
int minimumLength,
char fillingChar)
|
static String |
read(Reader reader)
Reads the data from the reader until its end is reached. |
static String |
readFile(String filename)
Deprecated. This method uses the system default encoding, which if diferent from the file's encoding may cause data corruption. Instead of using this method use readFile(String, String) specifying the correct
encoding. |
static String |
readFile(String filename,
String encoding)
|
static String |
stringRepeat(char ch,
int count)
Generate a string repeating the 'ch' character 'count' times. |
static String |
stringReplace(String str,
String target,
String replacement)
|
static String |
stringReplace(String str,
String target,
String replacement,
boolean replaceOnlyFirstOccurrence)
|
static void |
writeFile(String filename,
String content,
boolean append)
Deprecated. Since 4.0.8, use writeFile(String, String, String, boolean)
because this method uses the system default charset encoding. |
static void |
writeFile(String filename,
String content,
String charset,
boolean append)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public TextUtil()
Method Detail |
---|
public static String stringReplace(String str, String target, String replacement)
str
- is the original String which may contain substring target.target
- is the substring which is to be replaced.replacement
- is the replacement for target.public static String stringReplace(String str, String target, String replacement, boolean replaceOnlyFirstOccurrence)
public static String escapeRegexpReplacement(String replacementString)
replacementString
- the replacement string.
public static String escapeJs(String javascriptString)
Single quotes, double quotes, '\', next line and line feed characters are escaped.
javascriptString
- the javacript string raw value.
public static String escapeLocalizationParameter(String str)
str
- the string to escape.
public static String joinStringCollection(Collection<String> strings, String delim)
strings
- the collectino with the strings.delim
- the delimiter.
public static String joinStringArray(String[] array, String delim)
public static StringBuffer joinStringArray(String[] array, String delim, StringBuffer sb)
@Deprecated public static String readFile(String filename) throws FileNotFoundException, IOException
readFile(String, String)
specifying the correct
encoding.
filename
- the filename.
FileNotFoundException
IOException
public static String readFile(String filename, String encoding) throws FileNotFoundException, IOException
FileNotFoundException
IOException
public static String read(Reader reader) throws IOException
reader
- the reader.
IOException
- if an I/O error occurs.@Deprecated public static void writeFile(String filename, String content, boolean append) throws IOException
writeFile(String, String, String, boolean)
because this method uses the system default charset encoding.
IOException
public static void writeFile(String filename, String content, String charset, boolean append) throws IOException, PortalException
IOException
PortalException
public static void copyFile(String sourceFile, String targetFile) throws IOException
IOException
@Deprecated public static FileWriter getFileWriter(String filename, boolean append) throws IOException
IOException
public static int indexOfCaseInsensitive(StringBuilder source, String findStr)
public static int indexOfCaseInsensitive(StringBuilder source, String findStr, int fromIndex)
public static String leftPad(String s, int minimumLength, char fillingChar)
public static String stringRepeat(char ch, int count)
ch
- The character to be repeatedcount
- The number of repetitions
public static String joinStringCollectionUserFriendly(List<String> listItems) throws PortalException
listItems
-
PortalException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |