You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
julia> using EnumX
julia> @enumx Fruit Apple Banana
julia> x = Fruit.Apple
julia> string(x)
"Apple"
The string does not include the scope. I would like a way to get the string representation with the scope prefixed which for this example would be "Fruit.Apple". Is there a way to do this?
The text was updated successfully, but these errors were encountered:
@DavidSagan - This is going to be kinda ugly, but maybe someone who knows Julia better can chime in.
julia> @enumx Fruit Apple Banana
julia> function Base.print(io::IO, f::Fruit.T)
n = Dict(Fruit.Apple => "Apple", Fruit.Banana => "Banana")
s = "Fruit.$(n[f])"
write(io, s)
end
julia> string(Fruit.Apple)
"Fruit.Apple"
julia> string(Fruit.Banana)
"Fruit.Banana"
For example:
The string does not include the scope. I would like a way to get the string representation with the scope prefixed which for this example would be
"Fruit.Apple"
. Is there a way to do this?The text was updated successfully, but these errors were encountered: