程序包 proguard.util

类 StringUtil


  • public class StringUtil
    extends java.lang.Object
    This class contains utility methods for strings.
    • 构造器概要

      构造器 
      构造器 说明
      StringUtil()  
    • 方法概要

      所有方法 静态方法 具体方法 
      修饰符和类型 方法 说明
      static java.lang.String escapeControlCharacters​(java.lang.String input)
      Escapes control characters (\n, \r, \b, \t, \f).
      static byte[] getModifiedUtf8Bytes​(java.lang.String string)
      Returns the modified UTF-8 byte array representation of the given string.
      static int getModifiedUtf8Length​(java.lang.String string)
      Returns the length of the modified UTF-8 byte array representation of the given string.
      static java.lang.String getString​(byte[] modifiedUtf8Bytes)
      Returns the String representation of the given modified UTF-8 byte array.
      static java.lang.String getString​(byte[] modifiedUtf8Bytes, int startIndex, int endIndex)
      Returns the String representation of the given modified UTF-8 byte array.
      static java.lang.String join​(java.lang.String separator, java.lang.String... strings)
      Joins the given strings using the provided separator.
      static java.lang.String listToString​(java.util.List<java.lang.String> stringList)
      Converts a List of Strings to a nicely readable format.
      static java.lang.String toHexString​(byte[] bytes)
      Returns the hexadecimal representation of the given byte array.
      static java.lang.String toHexString​(byte[] bytes, java.lang.String separator, boolean upperCase)
      Returns the hexadecimal representation of the given byte array.
      • 从类继承的方法 java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 构造器详细资料

      • StringUtil

        public StringUtil()
    • 方法详细资料

      • getModifiedUtf8Length

        public static int getModifiedUtf8Length​(java.lang.String string)
        Returns the length of the modified UTF-8 byte array representation of the given string.
      • getModifiedUtf8Bytes

        public static byte[] getModifiedUtf8Bytes​(java.lang.String string)
        Returns the modified UTF-8 byte array representation of the given string.

        Note: surrogate pairs are encoded separately as three byte values as requested by the modified UTF-8 specification. This method is suited for encoding strings stored in class files, dex files or native libraries.

      • getString

        public static java.lang.String getString​(byte[] modifiedUtf8Bytes)
        Returns the String representation of the given modified UTF-8 byte array.
      • getString

        public static java.lang.String getString​(byte[] modifiedUtf8Bytes,
                                                 int startIndex,
                                                 int endIndex)
        Returns the String representation of the given modified UTF-8 byte array.
      • join

        public static java.lang.String join​(java.lang.String separator,
                                            java.lang.String... strings)
        Joins the given strings using the provided separator.
        参数:
        separator - The separator to use.
        strings - The strings to join.
        返回:
        The input strings, concatenated together using the separator
      • toHexString

        public static java.lang.String toHexString​(byte[] bytes)
        Returns the hexadecimal representation of the given byte array.
      • toHexString

        public static java.lang.String toHexString​(byte[] bytes,
                                                   java.lang.String separator,
                                                   boolean upperCase)
        Returns the hexadecimal representation of the given byte array.
      • escapeControlCharacters

        public static java.lang.String escapeControlCharacters​(java.lang.String input)
        Escapes control characters (\n, \r, \b, \t, \f).
      • listToString

        public static java.lang.String listToString​(java.util.List<java.lang.String> stringList)
        Converts a List of Strings to a nicely readable format. Example: ["foo", "bar", "baz"].