All Projects → afsalthaj → safe-string-interpolation

afsalthaj / safe-string-interpolation

Licence: MIT License
A type driven approach to string interpolation, aiming at consistent, secure, and only-human-readable logs and console outputs !

Programming Languages

scala
5932 projects

Projects that are alternatives of or similar to safe-string-interpolation

Androidlibrary
Android library to reveal or obfuscate strings and assets at runtime
Stars: ✭ 162 (+1057.14%)
Mutual labels:  string, string-manipulation
Superstring.py
A fast and memory-optimized string library for heavy-text manipulation in Python
Stars: ✭ 231 (+1550%)
Mutual labels:  string, string-manipulation
Voca rs
Voca_rs is the ultimate Rust string library inspired by Voca.js, string.py and Inflector, implemented as independent functions and on Foreign Types (String and str).
Stars: ✭ 167 (+1092.86%)
Mutual labels:  string, string-manipulation
Better Strings
Java String Interpolation Plugin
Stars: ✭ 66 (+371.43%)
Mutual labels:  string, interpolation
comment-mark
Interpolate strings with HTML comment markers!
Stars: ✭ 21 (+50%)
Mutual labels:  string, interpolation
Strman Java
A Java 8 string manipulation library.
Stars: ✭ 1,362 (+9628.57%)
Mutual labels:  string, string-manipulation
Util
A collection of useful utility functions
Stars: ✭ 201 (+1335.71%)
Mutual labels:  string, string-manipulation
Stringplus
Funny and minimal string library for C++ inspired by underscore.string
Stars: ✭ 7 (-50%)
Mutual labels:  string, string-manipulation
node-red-contrib-string
Provides a string manipulation node with a chainable UI based on the concise and lightweight stringjs.com.
Stars: ✭ 15 (+7.14%)
Mutual labels:  string, string-manipulation
vbml
Way to check, match and resist.
Stars: ✭ 27 (+92.86%)
Mutual labels:  string, string-manipulation
Litestringbuilder
Alternative to the System.Text.StringBuilder C# class.
Stars: ✭ 48 (+242.86%)
Mutual labels:  string, string-manipulation
normalize-text
📝 Provides a simple API to normalize texts, whitespaces, paragraphs & diacritics.
Stars: ✭ 54 (+285.71%)
Mutual labels:  string, string-manipulation
Cracking The Coding Interview
Solutions for Cracking the Coding Interview - 6th Edition
Stars: ✭ 35 (+150%)
Mutual labels:  string, string-manipulation
Strtk
C++ String Toolkit Library
Stars: ✭ 113 (+707.14%)
Mutual labels:  string, string-manipulation
Mightystring
Making Ruby Strings Powerful
Stars: ✭ 28 (+100%)
Mutual labels:  string, string-manipulation
Str
A fast, solid and strong typed string manipulation library with multibyte support
Stars: ✭ 199 (+1321.43%)
Mutual labels:  string, string-manipulation
Tiny Utf8
Unicode (UTF-8) capable std::string
Stars: ✭ 322 (+2200%)
Mutual labels:  string, string-manipulation
Portable Utf8
🉑 Portable UTF-8 library - performance optimized (unicode) string functions for php.
Stars: ✭ 405 (+2792.86%)
Mutual labels:  string, string-manipulation
Pupa
Simple micro templating
Stars: ✭ 231 (+1550%)
Mutual labels:  string, interpolation
split-on-first
Split a string on the first occurrence of a given separator
Stars: ✭ 68 (+385.71%)
Mutual labels:  string, string-manipulation

Typesafe Interpolation

Build Status Gitter Maven Central

An insanely simple type driven approach to string interpolation, aiming at consistent, secure, and only-human-readable logs and console outputs, and for safe string operations !

@ import $ivy.`io.github.afsalthaj::safe-string-interpolation:2.1.3`
import $ivy.$

@ import com.thaj.safe.string.interpolator._
import com.thaj.safe.string.interpolator._

@ case class Port(int: Int) extends AnyVal
defined class Port

@ val port = Port(1)
port: Port = Port(1)

@ ss"Db details: Port is ${port}"
cmd7.sc:1: could not find implicit value for parameter ev: com.thaj.safe.string.interpolator.Safe[ammonite.$sess.cmd5.Port]
val res7 = ss"Db details: Port is ${port}"
           ^
Compilation Failed

@ ss"Db details: Port is ${port.int}"
res7: SafeString = SafeString("Db details: Port is 1")

// Another example
@ case class Prefix(value: String) 
defined class Prefix

@ case class BucketName(value: String) 
defined class BucketName

@ val prefix = Prefix("foo") 
prefix: Prefix = Prefix("foo")

@ val bucketName = BucketName("6666-bucket") 
bucketName: BucketName = BucketName("6666-bucket")

@ val path = s"${bucketName}/${prefix}" 
path: String = "BucketName(6666-bucket)/Prefix(foo)"

@ val path = ss"${bucketName}/${prefix}" 
cmd7.sc:1: could not find implicit value for parameter ev: com.thaj.safe.string.interpolator.Safe[ammonite.$sess.cmd2.BucketName]
val path = ss"${bucketName}/${prefix}"
           ^
Compilation Failed


// Autoderivation module
@ import instances._
import instances._

@ ss"Db details: Port is ${port}"
res9: SafeString = SafeString("Db details: Port is { int : 1 }")

Checkout the project website for more features and possibilities.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].