weberc2
weberc2

Reputation: 7958

Ada String to Enumeration Conversion

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

Upvotes: 5

Views: 3021

Answers (1)

weberc2
weberc2

Reputation: 7958

example:

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

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

Upvotes: 8

Related Questions