public class StringUtil extends Object
Constructor and Description |
---|
StringUtil() |
Modifier and Type | Method and Description |
---|---|
static String |
arrayToString(Object[] a,
String separator) |
static String |
removeNonUtf8Chars(String src) |
static String |
split(String src,
char separator,
int tokenSize)
Splits a string into tokens separated by a separator
|
static String[] |
split(String src,
int tokenSize)
Splits a string into an array of tokens
|
static String |
writeToString(InputStream is,
String targetEncoding) |
static String |
writeToString(Reader reader)
Writes to UFT-8 encoding.
|
static String |
writeToString(Reader reader,
String targetEncoding)
Writes the content from the reader in a string encoded as specified.
|
public static String split(String src, char separator, int tokenSize)
src
- The source stringseparator
- The separator charactertokenSize
- Size or each tokenpublic static String[] split(String src, int tokenSize)
src
- The source stringtokenSize
- size of each tokenpublic static String writeToString(Reader reader) throws IOException
IOException
public static String writeToString(Reader reader, String targetEncoding) throws IOException
reader
- Attention, this will be closed at the end of invocationtargetEncoding
- The output string encodingIOException
public static String writeToString(InputStream is, String targetEncoding) throws IOException
IOException
public static String removeNonUtf8Chars(String src) throws CharacterCodingException
CharacterCodingException
Copyright © 2008-2014 Logical Objects. All Rights Reserved.