public class Utf8s extends Object
| 限定符和类型 | 字段和说明 |
|---|---|
static Regexp |
ESCAPED_CHAR_REGEXP
e.g. : \x5C
e.g. :
e.g.
|
| 构造器和说明 |
|---|
Utf8s() |
| 限定符和类型 | 方法和说明 |
|---|---|
static String |
decodeChars(String text) |
static byte[] |
getBytes(String s)
Retrieves a UTF-8 byte representation of the provided string.
|
static char |
hexToChar(String hexChar)
0x5C
\x5C
ASCII 码表:
https://www.habaijian.com/
|
static char |
hexToChar(String hex,
boolean valid) |
static boolean |
isValidUTF8(byte[] b)
Indicates whether the contents of the provided array are valid UTF-8.
|
static String |
toString(byte[] b)
Retrieves a string generated from the provided byte array using the UTF-8
encoding.
|
static String |
toString(byte[] b,
int offset,
int length)
Retrieves a string generated from the specified portion of the provided
byte array using the UTF-8 encoding.
|
public static final Regexp ESCAPED_CHAR_REGEXP
public static boolean isValidUTF8(@NonNull byte[] b)
b - The byte array to examine. It must not be null.true if the byte array can be parsed as a valid UTF-8
string, or false if not.@NonNull public static byte[] getBytes(@Nullable String s)
s - The string for which to retrieve the UTF-8 byte representation.@NonNull public static String toString(@NonNull byte[] b)
b - The byte array for which to return the associated string.@NonNull public static String toString(@NonNull byte[] b, int offset, int length)
b - The byte array for which to return the associated string.offset - The offset in the array at which the value begins.length - The number of bytes in the value to convert to a string.public static char hexToChar(String hexChar)
ASCII 码表: https://www.habaijian.com/
public static char hexToChar(String hex, boolean valid)
Copyright © 2022. All rights reserved.