public final class TextUtils extends Object
| Modifier and Type | Method and Description | 
|---|---|
| static byte | castAsByte(int c)Casts character to byte filtering non-visible and non-ASCII characters before conversion. | 
| static boolean | containsBlanks(CharSequence s)Tests whether a CharSequence contains any whitespace. | 
| static boolean | isAllASCII(CharSequence s)Determines whether the given  CharSequencecontains only ASCII characters. | 
| static boolean | isBlank(CharSequence s)Checks if a CharSequence is empty (""), null or whitespace only. | 
| static boolean | isEmpty(CharSequence s)Tests whether the parameter is null or of zero length. | 
| static int | length(CharSequence cs)Gets a CharSequence length or  0if the CharSequence isnull. | 
| static String | toHexString(byte[] bytes)Returns a hexadecimal string with lowercase letters, representing the
 values of the  bytes. | 
| static String | toLowerCase(String s)Converts a String to its lower case representation using  Locale.ROOT. | 
public static boolean isEmpty(CharSequence s)
s - The CharSequence to test.public static boolean isBlank(CharSequence s)
Checks if a CharSequence is empty (""), null or whitespace only.
Whitespace is defined by Character.isWhitespace(char).
 TextUtils.isBlank(null)      = true
 TextUtils.isBlank("")        = true
 TextUtils.isBlank(" ")       = true
 TextUtils.isBlank("abg")     = false
 TextUtils.isBlank("  abg  ") = false
 s - the CharSequence to check, may be nulltrue if the CharSequence is null, empty or whitespace onlypublic static int length(CharSequence cs)
0 if the CharSequence is
 null.cs - a CharSequence or null0 if the CharSequence is
         null.public static boolean containsBlanks(CharSequence s)
s - The CharSequence to test.public static String toHexString(byte[] bytes)
bytes.bytes - whose hex string should be createdpublic static String toLowerCase(String s)
Locale.ROOT.s - The String to convertpublic static boolean isAllASCII(CharSequence s)
CharSequence contains only ASCII characters.s - the CharSequence to checkCharSequence contains only ASCII characters, false otherwiseIllegalArgumentException - if the input CharSequence is null@Internal public static byte castAsByte(int c)
c - The character to cast.'?'.Copyright © 2005–2021 The Apache Software Foundation. All rights reserved.