ShortStrings.jl
ShortStrings.jl copied to clipboard
Construct from MVector
I have a StaticArrays.MVector and I want to make ShortString. Should this be possible?
julia> using StaticArrays, ShortStrings; ShortString(@MVector UInt8[1,2,3,4])
Error showing value of type ShortString{MVector{4, UInt8}}:
ERROR: DimensionMismatch("No precise constructor for MVector{4, UInt8} found. Length of input was 1.")
You need to broadcast over the vector.
julia> ShortString.(@MVector UInt8[1,2,3,4])
4-element MVector{4, ShortString{UInt8}} with indices SOneTo(4):
""
""
""
""
I want to make one ShortString out of the MVector, just like I can make one String out of the MVector.
julia> String(@MVector UInt8[97,98,99])
"abc"
julia> ShortString(@MVector UInt8[97,98,99])
Error showing value of type ShortString{MVector{3, UInt8}}:
ERROR: DimensionMismatch("No precise constructor for MVector{3, UInt8} found. Length of input was 1.")