Package io.didomi.sdk.common.extension
Class StringKt
-
- All Implemented Interfaces:
public final class StringKt
-
-
Method Summary
Modifier and Type Method Description final static StringmakeSnakeCase(String $self)Convert string to snake case: remove spaces and replace them with underscores and lowercase the string Used for cleaning the font name final static BooleanisHtmlLink(String $self)Checks if String is a valid URL final static BooleanisJsonLink(String $self)Checks if String is a valid URL to a json file final static BooleancontainsHtmlLink(String $self, String link)Checks if text contains a link to the specified URL final static Stringtransform(String $self, StringTransformation transformation, Locale locale)String transformation with locale final static LongtoSafeLong(String $self, Long default)String to long with default value final static StringreplaceHtmlAmpersand(String $self)Replace HTML Ampersand final static SpannedtoHtml(String $self)Compute string as Html final static SpannedtoHtmlAsLink(String $self, String url)Add link to string label and convert to HTML Spannable -
-
Method Detail
-
makeSnakeCase
final static String makeSnakeCase(String $self)
Convert string to snake case: remove spaces and replace them with underscores and lowercase the string Used for cleaning the font name
-
isHtmlLink
final static Boolean isHtmlLink(String $self)
Checks if String is a valid URL
-
isJsonLink
final static Boolean isJsonLink(String $self)
Checks if String is a valid URL to a json file
-
containsHtmlLink
final static Boolean containsHtmlLink(String $self, String link)
Checks if text contains a link to the specified URL
- Parameters:
link- the URL to check
-
transform
final static String transform(String $self, StringTransformation transformation, Locale locale)
String transformation with locale
- Parameters:
transformation- to applylocale- to use
-
toSafeLong
final static Long toSafeLong(String $self, Long default)
String to long with default value
- Parameters:
default- value to use if string conversion failed
-
replaceHtmlAmpersand
final static String replaceHtmlAmpersand(String $self)
Replace HTML Ampersand
-
toHtmlAsLink
final static Spanned toHtmlAsLink(String $self, String url)
Add link to string label and convert to HTML Spannable
- Parameters:
url- the link as String
-
-
-
-