julia> Pkg.clone("https://github.com/EricForgy/StringInterpolation.jl.git")
julia> using StringInterpolation
julia> x = "World"
julia> @interpolate "Hello \$x"
"Hello World"
macro test_str(s)
return quote
str = @interpolate $s
# Do what you want to do with interpolated string here.
sprint(print,str)
end
end
macro triple_str(s)
return quote
str = @interpolate $s
sprint(print,str^3)
end
end
julia> x = "World"; println(triple"Hello \$x\n")
Hello World
Hello World
Hello WorldYou might also want to handle the $(xxx) form of interpolation (which can get pretty tricky I imagine), as well as all of the \ escapes, such as \n, \x, \u, \U, etc.
julia> z = "World" ; u"Hello \(z)"
"Hello World"
julia> u"\u{1f596} \{circ} \:grin: "
"🖖 ∘ 😁 "