Examples of IReplace


Examples of winterwell.utils.IReplace

    text = text.replaceAll("\\\\rquote\\s?", "'");
    text = text.replaceAll("\\\\ldblquote\\s?", "\"");
    text = text.replaceAll("\\\\rdblquote\\s?", "\"");
    // hex-encoded non-ascii chars
    text = StrUtils.replace(text, Pattern.compile("\\\\'([0-9a-f]{2})"),
        new IReplace() {
          @Override
          public void appendReplacementTo(StringBuilder sb,
              Matcher match) {
            // String s = match.group();
            char c = (char) Integer.parseInt(match.group(1), 16);
            sb.append(c);
          }
        });
    // paragraph markers -- can we ignore these and count on line breaks??
    text = text.replaceAll("\\\\par\\b[^\r\n]", "\n\n");
    text = text.replaceAll("\\\\par\\b", "");
    text = text.replaceAll("\\\\line\\b", "\n");

    // italics and bold into markdown
    // NB: \i0 is "italics off"
    text = text.replaceAll("\\\\b0?", "**");
    text = text.replaceAll("\\\\i0?", "*");

    // strip the stuff we don't convert!
    text = StrUtils.replace(text, CONTROL_CODE, new IReplace() {
      @Override
      public void appendReplacementTo(StringBuilder sb, Matcher match) {
        String s = match.group();
        String s1 = match.group(1);
        // String s2 = match.group(2);
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.