ASCIIString not defined

Does anyone knows why I get this error?

k=match(r"#\s*(\w+)\s*=\s*(.+)", “# K = 4”)
convert(ASCIIString,k.captures[1])

UndefVarError: ASCIIString not defined

Stacktrace:
[1] include_string(::String, ::String) at .\loading.jl:522

ASCIIString no longer exists in Base, so you are apparently using code from Julia 0.4 or earlier — it will need to be updated in several ways, probably. Just use the String, k.captures[1]. If you need to check that it is ASCII, use isascii. In the rare cases where you actually need an ASCIIString type, you can use the LegacyStrings package.

Note that to upgrade code from an “ancient” version like Julia 0.4, it is best to first upgrade it to Julia 0.5, then upgrade it to Julia 0.6. This way, you will get helpful deprecation messages rather than simply errors.

3 Likes

yeah that makes lot sense. :slight_smile:
Thanks a lot!!!

Note that the LegacyStrings.jl package has not been updated for v0.7/master yet (but you should stay away from that anyway, unless you need to start getting your own packages ready for the v0.7 release, or are working on the release itself).