Package java.util.regex

Examples of java.util.regex.Matcher.start()


  }

  public Kind getKind() {
    Matcher m = EXTENSION_PATTERN.matcher(name);
    if (m.find()) {
      String extension = name.substring(m.start());
      for (Kind kind : Kind.values()) {
        if (extension.equals(kind.extension)) {
          return kind;
        }
      }
View Full Code Here


        }

        Matcher m = PARAM_PATTERN.matcher(org);
        int start = 0;
        while (m.find(start)) {
          if (m.start() != start) {
            writeString(msg.getSourcePosition(), org.substring(start, m.start()));
          }
          String s = m.group().substring(1);
          if (s.equals("%")) {
            writeString(msg.getSourcePosition(), "%");
View Full Code Here

        Matcher m = PARAM_PATTERN.matcher(org);
        int start = 0;
        while (m.find(start)) {
          if (m.start() != start) {
            writeString(msg.getSourcePosition(), org.substring(start, m.start()));
          }
          String s = m.group().substring(1);
          if (s.equals("%")) {
            writeString(msg.getSourcePosition(), "%");
          } else {
View Full Code Here

  protected static String formatGxpMessage(String org, String... params) {
    StringBuilder sb = new StringBuilder();
    Matcher m = PARAM_PATTERN.matcher(org);
    int start = 0;
    while (m.find(start)) {
      if (m.start() != start) {
        sb.append(org.substring(start, m.start()));
      }
      String s = m.group().substring(1);
      if (s.equals("%")) {
        sb.append('%');
View Full Code Here

    StringBuilder sb = new StringBuilder();
    Matcher m = PARAM_PATTERN.matcher(org);
    int start = 0;
    while (m.find(start)) {
      if (m.start() != start) {
        sb.append(org.substring(start, m.start()));
      }
      String s = m.group().substring(1);
      if (s.equals("%")) {
        sb.append('%');
      } else {
View Full Code Here

            sb.setLength(0);
            m = SPACES.matcher(text);
            int start = 0;
            while (true) {
              if (m.find(start)) {
                sb.append(text, start, m.start());
                start = m.end();
                sb.append(interiorSpaceOperator.apply(m.group()));
              } else {
                sb.append(text, start, text.length());
                break;
View Full Code Here

    // find the %[1-9%] locations in a list...
    List<Integer> locs = Lists.newArrayList();
    Matcher m = PARAM_PATTERN.matcher(msg);
    int start = 0;
    while (m.find(start)) {
      locs.add(m.start());
      start = m.end();
    }

    // but save them in an array so we only unbox once
    int counter = 0;
View Full Code Here

      private String evalPlaceholder(String original, String paramVar) {
        List<String> parts = Lists.newArrayList();
        Matcher m = PARAM_PATTERN.matcher(original);
        int cur = 0;
        while (m.find(cur)) {
          if (cur != m.start()) {
            parts.add(JAVASCRIPT.toStringLiteral(original.substring(cur, m.start())));
          }
          char ch = original.charAt(m.start() + 1);
          if (m.group(1).equals("%")) {
            parts.add("'%'");
View Full Code Here

        List<String> parts = Lists.newArrayList();
        Matcher m = PARAM_PATTERN.matcher(original);
        int cur = 0;
        while (m.find(cur)) {
          if (cur != m.start()) {
            parts.add(JAVASCRIPT.toStringLiteral(original.substring(cur, m.start())));
          }
          char ch = original.charAt(m.start() + 1);
          if (m.group(1).equals("%")) {
            parts.add("'%'");
          } else {
View Full Code Here

        int cur = 0;
        while (m.find(cur)) {
          if (cur != m.start()) {
            parts.add(JAVASCRIPT.toStringLiteral(original.substring(cur, m.start())));
          }
          char ch = original.charAt(m.start() + 1);
          if (m.group(1).equals("%")) {
            parts.add("'%'");
          } else {
            parts.add(paramVar + "[" + (Integer.parseInt(m.group(1)) - 1) + "]");
          }
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.