String.data in Compat.jl?


#1
julia> a = "str"
"str"

julia> b = a.data
ERROR: type String has no field data
Use `Vector{UInt8}(str)` instead.

#2

What are you suggesting? The newer form should work on all versions supported by compat


#3

I hit send before completely formulating the question. I didn’t See from the compat docu if it’s Supported.


#4

What’s the question then? There’s nothing that needs to be supported in Compat.


#5

I was confused. Initially i tried to ask: How can i use Compat for string.data issues. But (as you wrote) str_data = Vector{UInt8}(str) is working in julia versions, independent of Compat.


#6

It might be nice if we could suggest use b"str" instead, but I don’t think we can know that the String came from a constant.