Package-level declarations

Text utilities to allow the use of ANSI escape codes and case converting tools among other features.

TODO Create 'Pairs' class to model a list of pairs with repeatable keys Should allow to convert to list if keys are null, grouping values if there are duplicates Use it in serialization and HTTP fields (query params, forms, etc.)

TODO Remove logger class and make log utilities extension methods (creating a loggerOf() helper)

TODO logger and security may be removed and their content moved to root

Types

Link copied to clipboard
object Ansi

Constants for console formatting with ANSI codes. They can be used in strings to enable or disable a display option.

Link copied to clipboard
object AnsiColor
Link copied to clipboard
object AnsiEffect
Link copied to clipboard
data class Glob(val pattern: String)

Properties

Link copied to clipboard
val CAMEL_CASE: Regex
Link copied to clipboard
val eol: String

Runtime specific end of line.

Link copied to clipboard
val KEBAB_CASE: Regex
Link copied to clipboard
val parsedClasses: Set<KClass<*>>

Supported types for the parseOrNull function.

Link copied to clipboard
val PASCAL_CASE: Regex
Link copied to clipboard
val SNAKE_CASE: Regex

Functions

Link copied to clipboard
fun String.banner(bannerDelimiter: String = "*"): String

Format the string as a banner with a delimiter above and below text. The character used to render the delimiter is defined.

Link copied to clipboard
fun String.camelToSnake(): String

Transform the target string from camel case to snake case.

Link copied to clipboard
fun String.camelToWords(): List<String>
Link copied to clipboard
fun String.decodeBase64(): ByteArray

Decode this base64 encoded string.

Link copied to clipboard
fun ByteArray.encodeToBase64(): String

Encode the content of this byteArray to base64.

fun String.encodeToBase64(): String

Encode this string to base64.

Link copied to clipboard
fun String.filter(prefix: String, suffix: String, parameters: Map<String, *>): String
Link copied to clipboard
fun String.filterVars(parameters: Map<*, *>): String

Filter the target string substituting each key by its value. The keys format resembles Mustache's one: {{key}} and all occurrences are replaced by the supplied value.

Link copied to clipboard
fun Regex.findGroups(text: String): List<MatchGroup>
Link copied to clipboard
fun String.kebabToWords(): List<String>
Link copied to clipboard
fun <T : Any> String.parse(type: KClass<T>): T
Link copied to clipboard
fun <T : Any> String?.parseOrNull(type: KClass<T>): T?
Link copied to clipboard
fun String.prependIndent(count: Int = 4, pad: String = " "): String
Link copied to clipboard
fun String.snakeToCamel(): String

Transform the target string from snake case to camel case.

Link copied to clipboard
fun String.snakeToWords(): List<String>
Link copied to clipboard
fun String.stripAccents(): String
Link copied to clipboard
fun String.stripAnsi(): String
Link copied to clipboard
fun <T : Enum<*>> String.toEnum(converter: (String) -> T): T
Link copied to clipboard
fun <T : Enum<*>> String.toEnumOrNull(converter: (String) -> T): T?
Link copied to clipboard
fun String.toEnumValue(): String
Link copied to clipboard
fun String.toStream(): InputStream
Link copied to clipboard
fun Enum<*>.toWords(): String
fun List<String>.toWords(): List<String>
Link copied to clipboard
fun utf8(vararg bytes: Int): String
Link copied to clipboard
fun List<String>.wordsToCamel(): String
Link copied to clipboard
fun List<String>.wordsToKebab(): String
Link copied to clipboard
fun List<String>.wordsToPascal(): String
Link copied to clipboard
fun List<String>.wordsToSentence(): String
Link copied to clipboard
fun List<String>.wordsToSnake(): String
Link copied to clipboard
fun List<String>.wordsToTitle(): String