com.vaadin.flow.internal.
Class StringUtil
Utility class for special string handling.
For internal use only. May be renamed or removed in a future release.
Since:
2.1.4
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic String
Generate a hash for given content.
static String
Generate hash for content using a given salt bytes and a given charset for string byte encoding.
static String
Generate hash for content using given charset for string byte encoding.
static String
removeComments
(String code) Removes comments (block comments and line comments) from the JS code.
static String
removeComments
(String code, boolean useStringApostrophe) Removes comments (block comments and line comments) from the JS code.
static String
stripSuffix
(String string, String suffix) Strips the given suffix from the given string, if the strings end with the suffix.
-
Constructor Details
-
StringUtil
public StringUtil()
-
-
Method Details
-
removeComments
Removes comments (block comments and line comments) from the JS code.
Parameters:
code
- code to clean comments fromReturns:
the code with removed comments
-
removeComments
Removes comments (block comments and line comments) from the JS code.
Parameters:
code
- code to clean comments fromuseStringApostrophe
- iftrue
then ' is also considered a string and comments will not be considered inside itReturns:
the code with removed comments
-
stripSuffix
Strips the given suffix from the given string, if the strings end with the suffix.
Parameters:
string
- the string to scansuffix
- the suffixReturns:
the string without the suffix at the end or the same string if the suffix was not found
-
getHash
Generate a hash for given content.
Parameters:
content
- content to generate hash forReturns:
hash String for given content. In case content is null or empty returns empty String.
-
getHash
Generate hash for content using given charset for string byte encoding.
Parameters:
content
- content to hashcharset
- charset for encodingReturns:
hash String for given content. In case content is null or empty * returns empty String.
-
getHash
Generate hash for content using a given salt bytes and a given charset for string byte encoding.
Parameters:
content
- content to hashsalt
- salt to be added into hash calculationcharset
- charset for encodingReturns:
hash String for given content. In case content is null or empty * returns empty String.
-