Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package telnet;
- import java.util.logging.Logger;
- import java.util.regex.Matcher;
- import java.util.regex.Pattern;
- public class Alias {
- private static final Logger log = Logger.getLogger(Alias.class.getName());
- public Alias() {
- }
- public String parse(String line) throws StringIndexOutOfBoundsException {
- char c = line.charAt(0);
- String s = String.valueOf(c);
- if ("/".equals(s)) {
- line = getAlias(line);
- }
- return line;
- }
- private String getAlias(String line) {
- // String sentence = line.subSequence(1, line.length()).toString();
- Pattern pattern = Pattern.compile("(\\w+)"); //(\w+)\.
- Matcher matcher = pattern.matcher(line);
- String action = null;
- String target = null;
- while (matcher.find()) {
- action = matcher.group(0);
- target = matcher.group(1);
- }
- log.info(action+target);
- return "";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment