java - Check if String contains regex match -
I am working on a program that is an interpreter for a simple language that works with the group and sets Operates. It currently works with the holding numbers set.
When the user defines the set, then the input looks like this: such as set1 = {1, 25, 5, 6} can also work, but do something like this so basically it does not matter to the empty space, if any What I need to check is what is there in between any And it works just fine. But this is a university assignment and I'm not sure that I have permission to use the So my question is, is there any other way that I can see that there is a regex in any Since this is an assignment, I will not write code outside, but there is an alternative solution: set1 = {1, 25, 5, 6};
Set1 = {1 25, 5,6}; should not
"," between numbers it's OK.
string
"," , anywhere After the blank space and the second number, I am doing this:
Pattern Pattern = Pattern.compile ("[0-9] [\" \ "] + [0- 9]" ); Matcher matcher = pattern.matcher (input); If (matcher.find ()) false return;
pattern and
Matcher .
string ? Or is there any other easy way to get it?
, Divide the string on the token (using
String.split () )
< Li> It is possible to determine For that:
"" while loop, or maybe something else. I'll tell you this.
Comments
Post a Comment