Say I have an enum which is just
(说我有一个枚举)
public enum Blah {
A, B, C, D
}
and I would like to find the enum value of a string, for example "A"
which would be Blah.A
.
(我想找到一个字符串的枚举值,例如"A"
就是Blah.A
)
How would it be possible to do this? (怎么可能做到这一点?)
Is the Enum.valueOf()
the method I need?
(Enum.valueOf()
是我需要的方法吗?)
If so, how would I use this? (如果是这样,我将如何使用它?)
ask by Malachi translate from so 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…