public final class Strings extends Object
| Modifier and Type | Method and Description |
|---|---|
static void |
appendJsonStringEscapedChar(char c,
Appendable jsonString) |
static void |
appendJsonStringEscapedChar(char c,
StringBuilder jsonString) |
static void |
appendSpaces(Appendable to,
int nrSpaces) |
static void |
appendSpaces(StringBuilder to,
int nrSpaces) |
static void |
appendUnsignedString(StringBuilder sb,
int nr,
int shift) |
static void |
appendUnsignedString(StringBuilder sb,
long nr,
int shift) |
static void |
appendUnsignedStringPadded(Appendable sb,
int nr,
int shift,
int padTo) |
static void |
appendUnsignedStringPadded(StringBuilder sb,
int nr,
int shift,
int padTo) |
static String |
commonPrefix(String... strs) |
static int |
compareTo(CharSequence s,
CharSequence t)
Deprecated.
use CharSequences.compare
|
static boolean |
contains(CharSequence string,
char... chars)
Deprecated.
use CharSequences.containsAnyChar instead.
|
static boolean |
contains(String string,
char... chars) |
static CharsetDecoder |
createUtf8Decoder() |
static CharsetEncoder |
createUtf8Encoder() |
static String |
decode(CharsetDecoder cd,
byte[] ba,
int off,
int len) |
static int |
distance(String s1,
String s2)
Deprecated.
use CharSequences.distance instead.
|
static byte[] |
encode(CharsetEncoder ce,
char[] ca,
int off,
int len) |
static int |
encode(CharsetEncoder ce,
char[] ca,
int off,
int len,
byte[] targetArray) |
static boolean |
endsWith(CharSequence qc,
CharSequence with)
Deprecated.
|
static boolean |
equals(CharSequence s,
CharSequence t)
Deprecated.
|
static void |
escapeJsonString(String toEscape,
Appendable jsonString) |
static void |
escapeJsonString(String toEscape,
StringBuilder jsonString)
Utility method to escape java strings to json strings.
|
static String |
fromUtf8(byte[] bytes)
Optimized UTF8 decoder.
|
static String |
fromUtf8(byte[] bytes,
int startIdx,
int length) |
static int |
getmaxNrBytes(CharsetEncoder ce,
int nrChars) |
static CharsetDecoder |
getUTF8CharsetDecoder() |
static CharsetEncoder |
getUTF8CharsetEncoder() |
static int |
hashcode(CharSequence cs)
Deprecated.
|
static boolean |
regionMatches(CharSequence t,
int toffset,
CharSequence other,
int ooffset,
int plen)
Deprecated.
use CharSequences.regionMatches.
|
static char[] |
steal(String str)
Steal the underlying character array of a String.
|
static CharSequence |
subSequence(CharSequence seq,
int startIdx,
int endIdx)
Deprecated.
|
static byte[] |
toUtf8(String str)
Optimized UTF8 string encoder.
|
static String |
truncate(String value,
int length) |
static String |
unescape(String what) |
static String |
withFirstCharLower(String str) |
static String |
wrap(char[] chars)
Create a String based on the provided character array.
|
static void |
writeReplaceWhitespaces(String str,
char replacement,
Appendable writer) |
public static final String EOL
@Deprecated public static int distance(@Nonnull String s1, @Nonnull String s2)
public static boolean contains(String string, char... chars)
@Deprecated public static boolean contains(CharSequence string, char... chars)
public static void writeReplaceWhitespaces(String str, char replacement, Appendable writer) throws IOException
IOExceptionpublic static char[] steal(String str)
str - public static String wrap(char[] chars)
chars - public static CharsetEncoder createUtf8Encoder()
public static CharsetDecoder createUtf8Decoder()
public static CharsetEncoder getUTF8CharsetEncoder()
public static CharsetDecoder getUTF8CharsetDecoder()
public static byte[] encode(CharsetEncoder ce, char[] ca, int off, int len)
public static int getmaxNrBytes(CharsetEncoder ce, int nrChars)
public static int encode(CharsetEncoder ce, char[] ca, int off, int len, byte[] targetArray)
public static String decode(CharsetDecoder cd, byte[] ba, int off, int len)
public static String fromUtf8(byte[] bytes)
bytes - public static String fromUtf8(byte[] bytes, int startIdx, int length)
public static byte[] toUtf8(String str)
str - @Deprecated public static int compareTo(@Nonnull CharSequence s, @Nonnull CharSequence t)
@Deprecated public static boolean equals(@Nonnull CharSequence s, @Nonnull CharSequence t)
@Deprecated public static int hashcode(CharSequence cs)
@Deprecated public static CharSequence subSequence(CharSequence seq, int startIdx, int endIdx)
@Deprecated public static boolean endsWith(CharSequence qc, CharSequence with)
public static void escapeJsonString(@Nonnull String toEscape, StringBuilder jsonString)
toEscape - - the java string to escape.jsonString - - the destination json String builder.public static void escapeJsonString(@Nonnull String toEscape, Appendable jsonString) throws IOException
IOExceptionpublic static void appendJsonStringEscapedChar(char c,
StringBuilder jsonString)
public static void appendJsonStringEscapedChar(char c,
Appendable jsonString)
throws IOException
IOExceptionpublic static void appendUnsignedString(StringBuilder sb, long nr, int shift)
public static void appendUnsignedString(StringBuilder sb, int nr, int shift)
public static void appendUnsignedStringPadded(StringBuilder sb, int nr, int shift, int padTo)
public static void appendUnsignedStringPadded(Appendable sb, int nr, int shift, int padTo) throws IOException
IOExceptionpublic static void appendSpaces(Appendable to, int nrSpaces) throws IOException
IOExceptionpublic static void appendSpaces(StringBuilder to, int nrSpaces)
@Deprecated public static boolean regionMatches(CharSequence t, int toffset, CharSequence other, int ooffset, int plen)
Copyright © 2018 SPF4J. All rights reserved.