Can someone help me (and change the title, I couldn't think of one)? I need to look for a command with Pircbot and I need it to be able to read a command like this:
!online user
And I need to do it with this:
something.equalsIgnoreCase("online");
I have no idea how to do it with it being able to read user with that and possibly export it to a variable? Can anyone help?
Sorry if it's really confusing.
You could use Scanner class in java.
This is a perfect case for a regular expression pattern.
Do something like
Pattern onlinePattern = Pattern.compile("online\\s(\\S)+(\\s|$)");
Matcher m = onlinePattern.matcher(stringToTest);
if (m.find()){
String username = m.group(1);
//... do your stuff here
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.