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.
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.