pointRegex

fukurou

the supreme coder
ADMIN
Java:
    public Point pointRegex(String str2Check) {
        // "[-+]?[0-9]{1,13}(\\.[0-9]*)?" for double numbers
        String theRegex = "[-+]?[0-9]{1,13}";
        Point result = new Point(0, 0);
        ArrayList<String> list = new ArrayList<String>();
        Pattern checkRegex = Pattern.compile(theRegex);
        Matcher regexMatcher = checkRegex.matcher(str2Check);
        while (regexMatcher.find()) {
            if (regexMatcher.group().length() != 0) {
                result.y = Integer.parseInt(regexMatcher.group().trim());
            }
        }
        String phase2 = str2Check.replace(result.y + "", "");
        phase2 = numberRegex(phase2).replaceAll("[^0-9]", "");
        if (phase2.isEmpty()) {
            return new Point(result.y, 0);
        }
        result.x = Integer.parseInt(phase2);
        return result;
    }
 
Top