org.apache.commons.lang3.StringEscapeUtils.escapeHtml3()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(5.0k)|赞(0)|评价(0)|浏览(286)

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

StringEscapeUtils.escapeHtml3介绍

[英]Escapes the characters in a String using HTML entities.

Supports only the HTML 3.0 entities.
[中]使用HTML实体转义字符串中的字符。
仅支持HTML 3.0实体。

代码示例

代码示例来源:origin: org.apache.commons/commons-lang3

@Test
public void testEscapeSurrogatePairs() throws Exception {
  assertEquals("\uD83D\uDE30", StringEscapeUtils.escapeCsv("\uD83D\uDE30"));
  // Examples from https://en.wikipedia.org/wiki/UTF-16
  assertEquals("\uD800\uDC00", StringEscapeUtils.escapeCsv("\uD800\uDC00"));
  assertEquals("\uD834\uDD1E", StringEscapeUtils.escapeCsv("\uD834\uDD1E"));
  assertEquals("\uDBFF\uDFFD", StringEscapeUtils.escapeCsv("\uDBFF\uDFFD"));
  assertEquals("\uDBFF\uDFFD", StringEscapeUtils.escapeHtml3("\uDBFF\uDFFD"));
  assertEquals("\uDBFF\uDFFD", StringEscapeUtils.escapeHtml4("\uDBFF\uDFFD"));
  assertEquals("\uDBFF\uDFFD", StringEscapeUtils.escapeXml("\uDBFF\uDFFD"));
}

代码示例来源:origin: org.eclipse.dirigible/dirigible-api-utils

/**
 * Escape HTML 3.
 *
 * @param input
 *            the input
 * @return the escaped input
 */
public static final String escapeHtml3(String input) {
  return StringEscapeUtils.escapeHtml3(input);
}

代码示例来源:origin: org.eclipse.dirigible/dirigible-api-facade-utils

/**
 * Escape HTML 3.
 *
 * @param input
 *            the input
 * @return the escaped input
 */
public static final String escapeHtml3(String input) {
  return StringEscapeUtils.escapeHtml3(input);
}

代码示例来源:origin: io.github.bckfnn/taggersty-core

@Override
public String encodeContent(String content) {
  return StringEscapeUtils.escapeHtml3(content);
}

代码示例来源:origin: io.github.bckfnn/taggersty-core

@Override
public String encodeAttribute(String content) {
  return StringEscapeUtils.escapeHtml3(content);
}

代码示例来源:origin: cn.dreampie/jfinal-web

public String escapeHtml(String text) {
 String value = text;
 if (text == null) {
  return text;
 } else {
  value = StringEscapeUtils.escapeHtml3(value);
  value = StringEscapeUtils.escapeHtml4(value);
 }
 return value;
}

代码示例来源:origin: apache/roller

/**
 * Return RSS 09x style description (escaped HTML version of entry text)
 */
public String getRss09xDescription(int maxLength) {
  String ret = StringEscapeUtils.escapeHtml3(getText());
  if (maxLength != -1 && ret.length() > maxLength) {
    ret = ret.substring(0,maxLength-3)+"...";
  }
  return ret;
}

代码示例来源:origin: com.synaptix.toast/toast-tk-rest-utils

public static void get(String url) {
  Client httpClient = Client.create();
  WebResource webResource = httpClient.resource(StringEscapeUtils.escapeHtml3(url));
  ClientResponse response = webResource.get(ClientResponse.class);
  int statusCode = response.getStatus();
  if(LOG.isDebugEnabled()){
    LOG.debug("Client response code: " + statusCode);
  }
}

代码示例来源:origin: org.xworker/xworker_core

public static String escapeHtml3(ActionContext actionContext){
  Thing self = actionContext.getObject("self");
  String str  = (String) self.doAction("getStr", actionContext);
  return StringEscapeUtils.escapeHtml3(str);
}

代码示例来源:origin: org.onap.ccsdk.sli.core/sli-common

sbuff.append(curAttr.getKey());
sbuff.append("</td><td>");
sbuff.append(StringEscapeUtils.escapeHtml3(curAttr.getValue().toString()));
sbuff.append("</td></tr>");

代码示例来源:origin: apache/marmotta

JLabel lblMsg = new JLabel("<html>"+StringEscapeUtils.escapeHtml3(message).replaceAll("\\n", "<br>"));
lblMsg.setFont(lblMsg.getFont().deriveFont(Font.BOLD, 16f));
GridBagConstraints cLabel = new GridBagConstraints();
root.add(lblMsg, cLabel);
JLabel lblDescr = new JLabel("<html>"+StringEscapeUtils.escapeHtml3(description).replaceAll("\\n", "<br>"));
cLabel.gridy++;
cLabel.insets = new Insets(0, 5, 5, 5);

代码示例来源:origin: apache/marmotta

dialog.getRootPane().setContentPane(root);
JLabel lblMsg = new JLabel("<html>"+StringEscapeUtils.escapeHtml3(message).replaceAll("\\n", "<br>"));
lblMsg.setFont(lblMsg.getFont().deriveFont(Font.BOLD, 16f));
GridBagConstraints cLabel = new GridBagConstraints();
root.add(lblMsg, cLabel);
JLabel lblDescr = new JLabel("<html>"+StringEscapeUtils.escapeHtml3(description).replaceAll("\\n", "<br>"));
cLabel.gridy++;
cLabel.insets = new Insets(0, 5, 5, 5);
  final JButton btn = new JButton("<html>"+StringEscapeUtils.escapeHtml3(o.label).replaceAll("\\n", "<br>"), MessageDialog.loadIcon(o.icon));
  if (StringUtils.isNotBlank(o.info)) {
    btn.setToolTipText("<html>"+StringEscapeUtils.escapeHtml3(o.info).replaceAll("\\n", "<br>"));

代码示例来源:origin: bioinformatics-ua/dicoogle

sb.append("\t<tag name=\"").append(s).append("\">").append(escapeHtml3(((String)r.getExtraData().get(s)).trim())).append("</tag>\n");

相关文章