within the enum class When input char comes in, use the regular expression Returns the appropriate enum value The task of implementing a function.
There are only examples of string types. It was weird, so I asked if the input is in the form of a string They said to leave the input in char Is there any way to do it with a Char type?
public enum MyType{
Type1, Type2, Type3;
static MyType getMyType(char keyword){
...
switch(keyword){
case ' [a-zA-Z0-9]* ' : return Type1;
case ' "not" ' : return Type2;
// The string "[a-zA-Z0-9]*" typeis2"
How do you treat a keyword as a char variable?
....
..
.
}
}
}
If keyword
is a character, the above code is a strange code.
You don't have to use quantifier, and the keyword won't match the letter not.
Did the questioner misunderstand the assignment, or was it an assistant? I think you answered wrong
© 2024 OneMinuteCode. All rights reserved.