gpt4 book ai didi

com.github.bordertech.wcomponents.WebUtilities.doubleEncodeBrackets()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-25 16:07:05 24 4
gpt4 key购买 nike

本文整理了Java中com.github.bordertech.wcomponents.WebUtilities.doubleEncodeBrackets()方法的一些代码示例,展示了WebUtilities.doubleEncodeBrackets()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WebUtilities.doubleEncodeBrackets()方法的具体详情如下:
包路径:com.github.bordertech.wcomponents.WebUtilities
类名称:WebUtilities
方法名:doubleEncodeBrackets

WebUtilities.doubleEncodeBrackets介绍

[英]Double encode open or closed brackets in the input String.
[中]对输入字符串中的开括号或闭括号进行双重编码。

代码示例

代码示例来源:origin: com.github.bordertech.wcomponents/wcomponents-core

@Test
public void testDoubleEncodeBracketsWithMultipleMatches() {
  String in = "&#123;&#125;<> &#123;&#125;&#125;";
  String out = "&amp;#123;&amp;#125;<> &amp;#123;&amp;#125;&amp;#125;";
  Assert.assertEquals("Double encode brackets not correct", out, WebUtilities.doubleEncodeBrackets(in));
}

代码示例来源:origin: com.github.bordertech.wcomponents/wcomponents-core

@Test
public void testDoubleEncodeBrackets() {
  String in = "&#123;&#125;<>";
  String out = "&amp;#123;&amp;#125;<>";
  Assert.assertEquals("Double encode brackets not correct", out, WebUtilities.doubleEncodeBrackets(in));
}

代码示例来源:origin: com.github.bordertech.wcomponents/wcomponents-core

@Test
public void testDoubleEncodeBracketsWithNoBrackets() {
  String in = "then you win";
  String out = in;
  Assert.assertEquals("Double encode brackets not correct", out, WebUtilities.doubleEncodeBrackets(in));
}

代码示例来源:origin: com.github.bordertech.wcomponents/wcomponents-core

/**
   * Unescape HTML entities to safe XML.
   *
   * <p>
   * Example</p>
   * <pre>
   * {@code StringEscapeHTMLToXMLUtil.unescapeToXML("&bull;&Dagger}"); // returns "•‡"}
   * {@code StringEscapeHTMLToXMLUtil.unescapeToXML("&lt;p&gt;"); // returns "&lt;p&gt;" not "<p>"}
   * </pre>
   *
   * @param input The String to unescape.
   * @return the input with all HTML4 character entities unescaped except those which are also XML entities.
   */
  public static String unescapeToXML(final String input) {
    if (Util.empty(input)) {
      return input;
    }
    // Check if input has encoded brackets
    String encoded = WebUtilities.doubleEncodeBrackets(input);
    String unescaped = UNESCAPE_HTML_TO_XML.translate(encoded);
    String decoded = WebUtilities.doubleDecodeBrackets(unescaped);
    return decoded;
  }
}

代码示例来源:origin: com.github.bordertech.wcomponents/wcomponents-core

xml = WebUtilities.doubleEncodeBrackets(xml);

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com