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

com.ebiznext.comet.utils.Formatter.scala Maven / Gradle / Ivy

There is a newer version: 0.2.6
Show newest version
package com.ebiznext.comet.utils

object Formatter extends Formatter

trait Formatter {

  /** Split a String into a Map
    * @param str : the string to be splitted
    * @return
    */
  implicit class RichFormatter(str: String) {

    def richFormat(replacement: Map[String, String]): String =
      replacement.foldLeft(str) { (res, entry) =>
        res.replaceAll("\\{\\{%s\\}\\}".format(entry._1), entry._2)
      }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy