# Documentation for suffixes of string macros?

**URL:** https://discourse.julialang.org/t/documentation-for-suffixes-of-string-macros/139658
**Category:** General Usage
**Tags:** documentation, macros
**Created:** [September 25, 2026, 12:31am UTC](https://discourse.julialang.org/t/documentation-for-suffixes-of-string-macros/139658 "2026-09-25T00:31:48Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![matthias314](https://avatars.discourse-cdn.com/v4/letter/m/a88e4f/32.png) [@matthias314](https://discourse.julialang.org/u/matthias314)
#### Post date: [September 25, 2026, 12:31am UTC](https://discourse.julialang.org/t/documentation-for-suffixes-of-string-macros/139658/1 "2026-09-25T00:31:48Z")

</div>

The README file on GitHub mentions that StaticStrings.jl uses string macros of the form `static"Hello world!"12` which take more than one parameter. I didn’t know that this is possible. Is this described anywhere in the Julia documentation? If not, what exactly are the rules?

---

<div class="post-metadata">

### Author: ![mkitti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkitti/32/12459_2.png) [@mkitti](https://discourse.julialang.org/u/mkitti)
#### Post date: [September 25, 2026, 12:38am UTC](https://discourse.julialang.org/t/documentation-for-suffixes-of-string-macros/139658/2 "2026-09-25T00:38:53Z")

</div>

See the section just above Generated Functions:

> **[Generated functions - Metaprogramming · The Julia Language](https://docs.julialang.org/en/v1/manual/metaprogramming/#Generated-functions)**
>
> The strongest legacy of Lisp in the Julia language is its metaprogramming support. Like Lisp, Julia represents its own code as a data structure of the language itself. Since code is represented by objects that can be created and manipulated from...

> Another way to define a macro would be like this:

```julia-auto
macro foo_str(str, flag)
    # do stuff
end

```

> This macro can then be called with the following syntax:

```julia-auto
foo"str"flag

```

> The type of flag in the above mentioned syntax would be a String with contents of whatever trails after the string literal.

---

<div class="post-metadata">

### Author: ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)
#### Post date: [September 25, 2026, 12:40am UTC](https://discourse.julialang.org/t/documentation-for-suffixes-of-string-macros/139658/3 "2026-09-25T00:40:36Z")

</div>

> [@matthias314](#):
>
> Is this described anywhere in the Julia documentation?

It’s not documented super clearly in the manual at the moment, it seems — this should really be fixed.

The way it works is that any suffix after the string is parsed as a second argument to the string macro:

```julia-auto
julia> macro foo_str(str, suffix="default")
         @show str
         @show suffix
         str
       end
@foo_str (macro with 2 methods)

julia> foo"string"
str = "string"
suffix = "default"
"string"

julia> foo"string"xyz
str = "string"
suffix = "xyz"
"string"

```

I’m not 100% sure what the rules are for parsing the suffix. It looks like most things get parsed as a string, but numbers get parsed as numbers:

```julia-auto
julia> foo"string"1
str = "string"
suffix = 1
"string"

julia> foo"string"1.
str = "string"
suffix = 1.0
"string"

```

---

<div class="post-metadata">

### Author: ![matthias314](https://avatars.discourse-cdn.com/v4/letter/m/a88e4f/32.png) [@matthias314](https://discourse.julialang.org/u/matthias314)
#### Post date: [September 25, 2026, 12:58am UTC](https://discourse.julialang.org/t/documentation-for-suffixes-of-string-macros/139658/4 "2026-09-25T00:58:54Z")

</div>

Thanks to both you!

I think it would help to use the word “string macro” in addition to “string literal” when discussing this in the documentation. The concept is referred to as “string macro” in several places in the documentation, but not where they are explained. So a full-text search doesn’t help.

---

<div class="post-metadata">

### Author: ![PatrickHaecker](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/patrickhaecker/32/222891_2.png) [@PatrickHaecker](https://discourse.julialang.org/u/PatrickHaecker)
#### Post date: [September 25, 2026, 3:09am UTC](https://discourse.julialang.org/t/documentation-for-suffixes-of-string-macros/139658/5 "2026-09-25T03:09:38Z")

</div>

So can we expect your PR, @matthias314? 😉

I think making the wording consistent in the documentation and possibly add some more linking between the places would be a welcomed contribution. It sounds like you just got already kind of an overview.
