var stringValue: String = "ort"
Run Code Online (Sandbox Code Playgroud)
如何在 android 中与 Kotlin 中的枚举类进行比较stringValue并nameOfCode从枚举类中Data获取相应的code值。
enum class Data(val nameOfCode: String, val code: String) {
WES("wes", "6"),
ORT("ort", "70"),
R("R", "7"),
RON("Ron", "6,7"),
LO("Lo", "6,70"),
OT("ot", "7,70"),
ALL("All", "6,7,7000")
}
Run Code Online (Sandbox Code Playgroud)
例如:这里的字符串值为“ort”,因此在枚举 ort 中对应的代码值为“70”。如何得到这个值。