# Conversion of Vector{UInt8} to String without copy

**URL:** <https://discourse.julialang.org/t/conversion-of-vector-uint8-to-string-without-copy/49837>\
**Category:** Performance\
**Created:** [November 9, 2020, 12:55pm UTC](https://discourse.julialang.org/t/conversion-of-vector-uint8-to-string-without-copy/49837 "2020-11-09T12:55:35Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [November 9, 2020, 3:42pm UTC](https://discourse.julialang.org/t/conversion-of-vector-uint8-to-string-without-copy/49837/5 "2020-11-09T15:42:09Z")

</div>

I’ve often felt there should be package (VectorStrings.jl?) for this: a safe (unlike WeakRefStrings), full-featured string type that wraps an arbitrary `AbstractVector{UInt8}`. This also came up recently in discussions of [mmapping strings](https://discourse.julialang.org/t/how-to-mmap-a-string/39291/15).

It wouldn’t be too hard to write; I’d be willing to help out if someone wanted to start such a package (under [https://github.com/JuliaStrings](https://github.com/JuliaStrings)).

There would be a fair amount of copy-and-paste code from `Base.String`, but that’s not so terrible — the `String` code has been stable for a long while. (Alternatively, one could add an `AbstractByteString` type to Base and generalize a bunch of `String` methods, but that’s not going to happen any time soon; it would be better to try it out in a package first and then potentially merge into Base later if it proves very useful.

---

_[View the full topic](https://discourse.julialang.org/t/conversion-of-vector-uint8-to-string-without-copy/49837)._
