Skip to content

matejcerny/replacements

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Replacements

Scala Native Scala.js Latest version Build Status codecov

Simple Scala 3 library for replacing placeholders in strings.

Usage

import io.github.matejcerny.replacements.*

case class MyValues(name: String, age: Int) derives ReplacementValues
val myValues = MyValues("John", 42)

val toBeReplaced = "Hello, {{name}}! You are {{age}} years old."

toBeReplaced.substitute(myValues) // Hello, John! You are 42 years old.
myValues.substitute(toBeReplaced) // Hello, John! You are 42 years old.

Installation

Add the library as a dependency:

libraryDependencies += "io.github.matejcerny" %% "replacements" % "0.3.0"

About

Simple Scala 3 library for replacing placeholders in strings

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages