com.vaadin.flow.internal.

Class StringUtil


  • public final class StringUtil
    extends Object

    Utility class for special string handling.

    For internal use only. May be renamed or removed in a future release.

    Since:

    2.1.4

    • Constructor Detail

      • StringUtil

        public StringUtil()
    • Method Detail

      • removeComments

        public static String removeComments(String code)

        Removes comments (block comments and line comments) from the JS code.

        Parameters:

        code - code to clean comments from

        Returns:

        the code with removed comments

      • removeComments

        public static String removeComments(String code,
                                            boolean useStringApostrophe)

        Removes comments (block comments and line comments) from the JS code.

        Parameters:

        code - code to clean comments from

        useStringApostrophe - if true then ' is also considered a string and comments will not be considered inside it

        Returns:

        the code with removed comments

      • getHash

        public static String getHash(String content)

        Generate a hash for given content.

        Parameters:

        content - content to generate hash for

        Returns:

        hash String for given content. In case content is null or empty returns empty String.