Package java.util.regex

Examples of java.util.regex.Pattern.split()


        }

        try {
            String line = null;
            while ((line = reader.readLine()) != null) {
                String[] split = whitespace.split(line);
                if (split[0].equals("solver_type")) {
                    SolverType solver = SolverType.valueOf(split[1]);
                    if (solver == null) {
                        throw new RuntimeException("unknown solver type");
                    }
View Full Code Here


        Pattern pattern = patternCache.get(regex);
        if (pattern == null) {
            pattern = Pattern.compile(regex);
            patternCache.put(regex, pattern);
        }
        return  pattern.split(toSplit, 0);
    }


    /**
     * <p>Returns the URL pattern of the
View Full Code Here

   private boolean isDayOfWeekBased(String relativeVal)
   {
      String trimmedVal = relativeVal.trim();
      // one or more spaces (which includes tabs and other forms of space)
      Pattern p = Pattern.compile("\\s+");
      String[] relativeParts = p.split(trimmedVal);
      if (relativeParts == null)
      {
         return false;
      }
      if (relativeParts.length != 2)
View Full Code Here

                if (requestedValuesParam != null) {
              String requestedString = requestedValuesParam.toString();
              Pattern pattern = getTokensPattern(component);

              if (pattern != null) {
            requestedValues = pattern.split(requestedString);
              } else {
            requestedValues = new String[] {requestedString};
              }
          } else {
              //TODO nick - review together with pasha
View Full Code Here

    private boolean isDayOfWeekBased(String relativeVal) {
        String trimmedVal = relativeVal.trim();
        // one or more spaces (which includes tabs and other forms of space)
        Pattern p = Pattern.compile("\\s+");
        String[] relativeParts = p.split(trimmedVal);
        if (relativeParts == null) {
            return false;
        }
        if (relativeParts.length != 2) {
            return false;
View Full Code Here

        String fetchString = new String(buffer);

        // fetch the xml tag <dogc>xxx</dogc>
        Pattern dowait = Pattern.compile("<dogc>",
                         Pattern.CASE_INSENSITIVE | Pattern.DOTALL | Pattern.MULTILINE);
        String[] results = dowait.split(fetchString);
        if (results.length != 2) {
          throw new IOException("Throttle: Unable to parse response of URL " + url +
                                ". Get retuned " + fetchString);
        }
        dowait = Pattern.compile("</dogc>",
View Full Code Here

          throw new IOException("Throttle: Unable to parse response of URL " + url +
                                ". Get retuned " + fetchString);
        }
        dowait = Pattern.compile("</dogc>",
                         Pattern.CASE_INSENSITIVE | Pattern.DOTALL | Pattern.MULTILINE);
        results = dowait.split(results[1]);
        if (results.length < 1) {
          throw new IOException("Throttle: Unable to parse response of URL " + url +
                                ". Get retuned " + fetchString);
        }
View Full Code Here

        } else {
            splitPattern = FIELD_COMMA_PATTERN;
        }
        List<String> results = new ArrayList<String>();
        for (String value : values) {
            String[] items = splitPattern.split(value);
            for (String item : items) {
                results.add(item.trim());
            }
        }
        return results;
View Full Code Here

  }

  public void testSplitEmpty() {

    Pattern pat = Pattern.compile("");
    String[] s = pat.split("", -1);

    assertEquals(1, s.length);
    assertEquals("", s[0]);
  }
View Full Code Here

    assertFalse(found);
  }

  public void testCompile5() throws PatternSyntaxException {
    Pattern p = Pattern.compile("^[0-9]");
    String s[] = p.split("12", -1);
    assertEquals("", s[0]);
    assertEquals("2", s[1]);
    assertEquals(2, s.length);
  }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.