All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.chestmc.common.extensions.strings.Placeholders.kt Maven / Gradle / Ivy

package net.chestmc.common.extensions.strings

import net.chestmc.common.placeholder.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