Stream: helpdesk (published)

Topic: ✔ How to convert a string to a VersionNumber?


view this post on Zulip Leandro Martínez (Nov 30 2023 at 17:55):

What's the correct way to make this work:

julia> str
"1.3.5-DEV"

julia> @v_str str
ERROR: LoadError: MethodError: no method matching VersionNumber(::Symbol)

From the doc entry the @v_str macro was supposed to do that, but the examples only use the v"" syntax, with a constant version number for the string. What if the version number is a variable?

view this post on Zulip Leandro Martínez (Nov 30 2023 at 17:56):

Ah... got it:

julia> VersionNumber(str)
v"1.3.5-DEV"

I guess that deserves a doc PR.

view this post on Zulip Notification Bot (Nov 30 2023 at 17:56):

Leandro Martínez has marked this topic as resolved.

view this post on Zulip Timothy (Nov 30 2023 at 17:56):

Or to be more explicit about what's going on, parse(VersionNumber, "1.3.5-DEV").


Last updated: Nov 22 2024 at 04:41 UTC