Package java.util.regex

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


    }

    public static String[] getLetters(String letters, String pattern)
    {
        Pattern splitter = Pattern.compile(pattern);
        String[] result = splitter.split(letters);

        return result;
    }

    public static String getWebFirstLetter(String address){
View Full Code Here


  {
    if (prefixes == null)
      return;
   
    Pattern regexp = Pattern.compile("[,\\s]+");
    String []strings = regexp.split(prefixes);
    for (int i = 0; i < strings.length; i++) {
      String prefix = strings[i];
      String ns = getNamespace(prefix);
      if (ns == null)
        throw error(L.l("`{0}' must be a namespace prefix", prefix));
View Full Code Here

            if (this.inputMessage instanceof WSIFMessageElement) {
                QName type = ((WSIFMessageElement) this.inputMessage).getPartType(name);
                if (LEADTypes.isArrayType(type)) {
                    // split string into items using " " as separator
                    Pattern pattern = Pattern.compile("[,\\s]+");
                    String[] result = pattern.split((String) value);
                    XmlElement arrayEl = XmlConstants.BUILDER.newFragment(name);
                    for (int i = 0; i < result.length; i++) {
                        logger.debug("split=" + result[i]);
                        arrayEl.addElement("value").addChild(result[i]);
                    }
View Full Code Here

  private static final Pattern SIMPLE_LIST_PATTERN   = Pattern.compile(",");
  private static final Pattern TRIMMED_LIST_PATTERN   = Pattern.compile("\\s*,\\s*");

  private List<String> list(String encodedList, boolean trimmed) {
    Pattern pattern = trimmed ? TRIMMED_LIST_PATTERN : SIMPLE_LIST_PATTERN;
    return encodedList != null ? Arrays.asList(pattern.split(delimited(encodedList))) : Collections.<String> emptyList();
  }


  /**
   * Skip all optional leading and ending delimiters for lists
View Full Code Here

  }
 
  private List<String> list(String propertyName, boolean trimmed) {
    Pattern pattern   = trimmed ? TRIMMED_LIST_PATTERN : SIMPLE_LIST_PATTERN;
    String encodedList  = property(propertyName);
    return encodedList != null ? Arrays.asList(pattern.split(delimited(encodedList))) : Collections.<String> emptyList();
  }

  /**
   * Skip all optional leading and ending delimiters for lists
   */
 
View Full Code Here

   * @return an array of split items
   */
  private static String[] split(String text, String keyword) {

    Pattern pattern = Pattern.compile(String.format(KEYWORD_TEMPLATE, keyword));
    return pattern.split(text);
  }

  /**
   * A part of the parsed source that results from splitting up the resource around {@literal Or} keywords. Consists of
   * {@link Part}s that have to be concatenated by {@literal And}.
View Full Code Here

    String[] temp;
    int port;
    Boolean bool = false;

    Pattern p = Pattern.compile(":");
    temp = p.split(host);

    InetAddress addr = InetAddress.getByName(temp[0]);
    if (temp.length == 2)
      port = Integer.valueOf(temp[1]).intValue();
    else
View Full Code Here

      br = new BufferedReader(new FileReader(branchheadsCache));
      String line = br.readLine();
      if (line == null || line.trim().length() == 0) {
        return lastInCache;
      }
      String[] cacheIdentity = spacePattern.split(line.trim());
      lastInCache = Integer.parseInt(cacheIdentity[1]);
      final int lastKnownRepoRevIndex = repo.getChangelog().getLastRevision();
      if (lastInCache > lastKnownRepoRevIndex || !repo.getChangelog().getRevision(lastKnownRepoRevIndex).equals(Nodeid.fromAscii(cacheIdentity[0]))) {
        // there are chances cache file got invalid entries due to e.g. rollback operation
        return -1;
View Full Code Here

      if (lastInCache > lastKnownRepoRevIndex || !repo.getChangelog().getRevision(lastKnownRepoRevIndex).equals(Nodeid.fromAscii(cacheIdentity[0]))) {
        // there are chances cache file got invalid entries due to e.g. rollback operation
        return -1;
      }
      while ((line = br.readLine()) != null) {
        String[] elements = spacePattern.split(line.trim());
        if (elements.length != 2) {
          // bad entry
          continue;
        }
        // I assume split returns substrings of the original string, hence copy of a branch name
View Full Code Here

            public Object evaluate(E exchange) {
                String text = evaluateStringExpression(expression, exchange);
                if (text == null) {
                    return null;
                }
                return Arrays.asList(pattern.split(text));
            }

            @Override
            public String toString() {
                return "regexTokenize(" + expression + ", " + pattern.pattern() + ")";
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.