Reputation: 71
How do I convert a symbol to a string in Julia? The following don't work:
String(:A)
convert(String,:A)
They did work in Julia version 0.4.
Upvotes: 5
Views: 5201
Reputation: 42214
You could use the string
function:
julia> string(:A)
"A"
However as of Julia 1.5.1 String(symb)
also seems to work:
julia> String(:A)
"A"
However String(:A)
is the recommended method as it just directly creates the String
object from Symbol
and hence is 3x faster.
Upvotes: 11