Examples of split()


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

  {
    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

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

            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

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

  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

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

  }
 
  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

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

   * @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

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

    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

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

      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

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

      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

Examples of net.sourceforge.cruisecontrol.util.TdTimer.split()

            return false;
        }
        TdTimer myTimer = new TdTimer();
        while (!getThreadQueue().resultList.containsKey(taskName)) {
            sleep(sleepTime);
            if (myTimer.split() > timeout) {
                return false;
            }
        }
        return true;
    }
View Full Code Here

Examples of org.antlr.v4.runtime.tree.pattern.ParseTreePatternMatcher.split()

import static org.junit.Assert.assertTrue;

public class TestParseTreeMatcher extends BaseTest {
  @Test public void testChunking() throws Exception {
    ParseTreePatternMatcher m = new ParseTreePatternMatcher(null, null);
    assertEquals("[ID, ' = ', expr, ' ;']", m.split("<ID> = <expr> ;").toString());
    assertEquals("[' ', ID, ' = ', expr]", m.split(" <ID> = <expr>").toString());
    assertEquals("[ID, ' = ', expr]", m.split("<ID> = <expr>").toString());
    assertEquals("[expr]", m.split("<expr>").toString());
    assertEquals("['<x> foo']", m.split("\\<x\\> foo").toString());
    assertEquals("['foo <x> bar ', tag]", m.split("foo \\<x\\> bar <tag>").toString());
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.