walkmc.extensions.strings.Placeholders.kt Maven / Gradle / Ivy
@file:Suppress("NOTHING_TO_INLINE")
package walkmc.extensions.strings
import walkmc.placeholder.*
/**
* Process this string with the specified placeholder and value.
*/
fun String.process(placeholder: Placeholder, value: T): String =
placeholder.process(this, value)
/**
* Process only specified placeholder in this string.
*/
fun String.process(value: Pair): String = process(value.first, value.second)
/**
* Process all specifieds placeholders in this string.
*/
fun String.process(vararg values: Pair): String {
var processed = this
for (value in values)
processed = processed.process(value.first, value.second)
return processed
}
/**
* Process all specifieds placeholders in this string.
*/
fun String.process(values: Map): String {
var processed = this
for (value in values)
processed = processed.process(value.key, value.value)
return processed
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy