Class TextUtil


  • @Scriptable
    public final class TextUtil
    extends Object
    • Method Detail

      • listToString

        public static String listToString​(Collection<String> p_list)
        Serializes a list of strings to a string using "|" as delimiter and "0" as escape character.

        Note that stringToList and listToString are inverse functions.

        Parameters:
        p_list - The list to serialize.
        Returns:
        The serialized array list.
      • listToString

        public static String listToString​(Collection<String> p_list,
                                          String p_strDel,
                                          String p_strEsc)
        Serializes a list of strings to a string.

        Note that stringToList and listToString are inverse functions.

        Parameters:
        p_list - The list to serialize.
        p_strDel - The delimiter sequence to use.
        p_strEsc - The escape sequence to use.
        Returns:
        The serialized array list.
      • stringToList

        public static LinkedList<String> stringToList​(String p_str)
        Deserialize a list of strings that was previously serialized with "|" as delimiter and "0" as escape character.

        Note that stringToList and listToString are inverse functions.

        Parameters:
        p_str - The string containing the serialized array.
        Returns:
        The deserialized array, or an empty list, if the given input is null, or empty.
      • stringToList

        public static LinkedList<String> stringToList​(String p_str,
                                                      String p_strDel,
                                                      String p_strEsc)
        Deserialize an array that was previously serialized using TextUtil#listToString(Collection, String, String).

        Note that stringToList and listToString are inverse functions.

        Parameters:
        p_str - The string containing the serialized array.
        p_strDel - The delimiter sequence to use.
        p_strEsc - The escape sequence to use.
        Returns:
        The deserialized array, or an empty list, if the given input is null, or empty.