Package org.opencms.gwt.client.util
Class CmsClientStringUtil
- java.lang.Object
-
- org.opencms.gwt.client.util.CmsClientStringUtil
-
public final class CmsClientStringUtil extends java.lang.Object
Additional string related helper methods.- Since:
- 8.0.0
- See Also:
CmsStringUtil
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static boolean
checkIsPathOrLinkToSvg(java.lang.String path)
Checks if the given string looks like a path or link to an SVG file.static java.lang.String
getMessage(java.lang.Throwable t)
Returns the exception message.static java.lang.String
getStackTrace(java.lang.Throwable t, java.lang.String separator)
Returns the stack trace of the Throwable as a string.static java.lang.String
getStackTraceAsString(java.lang.StackTraceElement[] trace, java.lang.String separator)
Returns the stack trace as a string.static double
parseFloat(java.lang.String str)
The parseFloat() function parses a string and returns a float.static int
parseInt(java.lang.String str)
The parseInt() function parses a string and returns an integer.static void
pushArray(com.google.gwt.core.client.JavaScriptObject array, java.lang.String s)
Pushes a String into a javascript array.static java.lang.String
randomUUID()
Generates a purely random uuid.static java.lang.String
shortenString(java.lang.String text, int maxLength)
Shortens the string to the given maximum length.
-
-
-
Method Detail
-
checkIsPathOrLinkToSvg
public static boolean checkIsPathOrLinkToSvg(java.lang.String path)
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
public static java.lang.String getMessage(java.lang.Throwable t)
Returns the exception message.- Parameters:
t
- the exception to get the message for- Returns:
- the exception message
-
getStackTrace
public static java.lang.String getStackTrace(java.lang.Throwable t, java.lang.String separator)
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
public static java.lang.String getStackTraceAsString(java.lang.StackTraceElement[] trace, java.lang.String separator)
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
public static double parseFloat(java.lang.String str)
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
public static int parseInt(java.lang.String str)
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
public static void pushArray(com.google.gwt.core.client.JavaScriptObject array, java.lang.String s)
Pushes a String into a javascript array.- Parameters:
array
- the array to push the String intos
- the String to push into the array
-
randomUUID
public static java.lang.String randomUUID()
Generates a purely random uuid.- Returns:
- the generated uuid
-
shortenString
public static java.lang.String shortenString(java.lang.String text, int maxLength)
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
-
-