Ada String to Enumeration Conversion

ada, enums, string

Solution

example:

-- type declaration
type Hands is (Left, Right);

-- code body
Hand : Hands;
Hand := Hands'Value("Left"); -- yields `Left`

Problem

I would like to cast an existing string to an enum (not read it in as an enum). How can I do this?

Original source