public class StringUtil extends Object
| 限定符和类型 | 类和说明 |
|---|---|
static class |
StringUtil.CharSequenceSlice
子串包装类(String已经没有共享内存的子串,无奈硬支持)
|
| 限定符和类型 | 字段和说明 |
|---|---|
static String[] |
_nilStrings
0项的字串数组
|
static char |
UNICODE_REPLACEMENT_CHAR
UTF-16的最后一个字符
|
static String |
UNICODE_REPLACEMENT_STRING
UTF-16的最后一个字符
|
static Charset |
UTF8 |
| 构造器和说明 |
|---|
StringUtil() |
| 限定符和类型 | 方法和说明 |
|---|---|
static int |
compareTo(String s1,
String s2)
比较两字串大小
|
static boolean |
eq(String s1,
String s2)
比较两字串是否相同
|
static InputStream |
fromBase64String(String base64String)
将base64字符串转换成输入流
|
static boolean |
isEmpty(String str)
是否空字串(null或length为0)
|
static boolean |
isUtf8(byte[] bytes,
int offset,
int len)
检查输入的字符流是否UTF-8字符
|
static String |
limit(String str,
int max)
把字串限制在指定长度内
|
static CharSequence |
subSequence(CharSequence str,
int start,
int end)
子串包装(共享根串)
|
static String |
toString(Object obj) |
public static final char UNICODE_REPLACEMENT_CHAR
public static final String UNICODE_REPLACEMENT_STRING
public static final String[] _nilStrings
public static final Charset UTF8
public static final boolean isEmpty(String str)
str - 字串public static final boolean eq(String s1, String s2)
s1 - 字串1s2 - 字串2public static InputStream fromBase64String(String base64String)
base64String - public static String limit(String str, int max)
str - 原始字串max - 限制的长度public static boolean isUtf8(byte[] bytes,
int offset,
int len)
bytes - 字节数组(字串流)offset - 开始位置(字节)len - 长度(字节)public static final int compareTo(String s1, String s2)
s1 - 字串1s2 - 字串2public static CharSequence subSequence(CharSequence str, int start, int end) throws IndexOutOfBoundsException
str - 串start - 子串开始位置end - 子串结束位置IndexOutOfBoundsExceptionCopyright © 2021. All rights reserved.