Package org.opencms.gwt.client.util
Class CmsClientStringUtil
java.lang.Object
org.opencms.gwt.client.util.CmsClientStringUtil
Additional string related helper methods.
- Since:
- 8.0.0
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleancheckIsPathOrLinkToSvg(String path) Checks if the given string looks like a path or link to an SVG file.static StringReturns the exception message.static StringgetStackTrace(Throwable t, String separator) Returns the stack trace of the Throwable as a string.static StringgetStackTraceAsString(StackTraceElement[] trace, String separator) Returns the stack trace as a string.static doubleparseFloat(String str) The parseFloat() function parses a string and returns a float.static intThe parseInt() function parses a string and returns an integer.static voidPushes a String into a javascript array.static StringGenerates a purely random uuid.static StringshortenString(String text, int maxLength) Shortens the string to the given maximum length.
-
Method Details
-
checkIsPathOrLinkToSvg
Checks if the given string looks like a path or link to an SVG file.- Parameters:
path- the path to check- Returns:
- true if the path looks like a path or link to an SVG file
-
getMessage
Returns the exception message.- Parameters:
t- the exception to get the message for- Returns:
- the exception message
-
getStackTrace
Returns the stack trace of the Throwable as a string.- Parameters:
t- the Throwable for which the stack trace should be returnedseparator- the separator between the lines of the stack trace- Returns:
- a string representing a stack trace
-
getStackTraceAsString
Returns the stack trace as a string.- Parameters:
trace- the stack traceseparator- the separator between the lines of the stack trace- Returns:
- a string representing a stack trace
-
parseFloat
The parseFloat() function parses a string and returns a float.Only the first number in the string is returned. Leading and trailing spaces are allowed.
- Parameters:
str- the string to be parsed- Returns:
- the parsed number
-
parseInt
The parseInt() function parses a string and returns an integer.Only the first number in the string is returned. Leading and trailing spaces are allowed. If the first character cannot be converted to a number, parseInt() returns zero.
- Parameters:
str- the string to be parsed- Returns:
- the parsed number
-
pushArray
Pushes a String into a javascript array.- Parameters:
array- the array to push the String intos- the String to push into the array
-
randomUUID
Generates a purely random uuid.- Returns:
- the generated uuid
-
shortenString
Shortens the string to the given maximum length.Will include HTML entity ellipses replacing the cut off text.
- Parameters:
text- the string to shortenmaxLength- the maximum length- Returns:
- the shortened string
-