# \[ANN\] KeywordStrings.jl --- A fun and convenient string macro for interpolations

**URL:** https://discourse.julialang.org/t/ann-keywordstrings-jl-a-fun-and-convenient-string-macro-for-interpolations/93011
**Category:** Package Announcements
**Created:** [January 16, 2023, 6:01am UTC](https://discourse.julialang.org/t/ann-keywordstrings-jl-a-fun-and-convenient-string-macro-for-interpolations/93011 "2023-01-16T06:01:06Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![adienes](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/adienes/32/37459_2.png) [@adienes](https://discourse.julialang.org/u/adienes)
#### Post date: [January 16, 2023, 6:01am UTC](https://discourse.julialang.org/t/ann-keywordstrings-jl-a-fun-and-convenient-string-macro-for-interpolations/93011/1 "2023-01-16T06:01:06Z")

</div>

Hi all, I have written my first package and pushed it here: [GitHub - adienes/KeywordStrings.jl: Flexible and convenient string formatting for the Julia language](https://github.com/adienes/KeywordStrings.jl). It is not yet registered but I thought I’d share.

It is very short: only 150 lines in `src` and the dependencies are only Base Julia. It exports the string macro `kw" ... "` which has some nice properties, most notably that undefined variables can be interpreted at a later time, e.g.

```julia
julia> struct User
           name
           value
       end

julia> me = User("Andy", 14)
User("Andy", 14)

julia> s = kw"Hello, $name ! Your value is $value"; # a KeywordString object

julia> s % me # a regular Julia String
"Hello, Andy! Your value is 14"

julia> s % (; name="Bob", value=0) # format with any obj with a `get` method
"Hello, Bob! Your value is 0"

```

For more examples check out the `README`! I mostly did this as a learning experience so any critiques or suggestions welcome.

---

<div class="post-metadata">

### Author: ![jar1](https://avatars.discourse-cdn.com/v4/letter/j/c0e974/32.png) [@jar1](https://discourse.julialang.org/u/jar1)
#### Post date: [January 16, 2023, 6:13am UTC](https://discourse.julialang.org/t/ann-keywordstrings-jl-a-fun-and-convenient-string-macro-for-interpolations/93011/2 "2023-01-16T06:13:28Z")

</div>

See also

> **[GitHub - JuliaString/Format.jl: A Julia package to provide C and Python-like...](https://github.com/JuliaString/Format.jl)**
>
> A Julia package to provide C and Python-like formatting support - GitHub - JuliaString/Format.jl: A Julia package to provide C and Python-like formatting support
