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

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

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

StringEscapeUtils.unescapeCsv介绍

暂无

代码示例

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

private LinkedHashSet<String> attributeListStringToSet(String attributeList) {
  //take the user specified attribute list string and convert to list of strings.
  LinkedHashSet<String> result = new LinkedHashSet<>();
  if (StringUtils.isNotBlank(attributeList)) {
    String[] ats = attributeList.split(SPLIT_REGEX);
    for (String str : ats) {
      result.add(StringEscapeUtils.unescapeCsv(str.trim()));
    }
  }
  return result;
}

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

@Test
public void testUnescapeCsvString() {
  assertEquals("foo.bar", StringEscapeUtils.unescapeCsv("foo.bar"));
  assertEquals("foo,bar", StringEscapeUtils.unescapeCsv("\"foo,bar\""));
  assertEquals("foo\nbar", StringEscapeUtils.unescapeCsv("\"foo\nbar\""));
  assertEquals("foo\rbar", StringEscapeUtils.unescapeCsv("\"foo\rbar\""));
  assertEquals("foo\"bar", StringEscapeUtils.unescapeCsv("\"foo\"\"bar\""));
  assertEquals("foo\uD84C\uDFB4bar", StringEscapeUtils.unescapeCsv("foo\uD84C\uDFB4bar"));
  assertEquals("", StringEscapeUtils.unescapeCsv(""));
  assertNull(StringEscapeUtils.unescapeCsv(null));
  assertEquals("\"foo.bar\"", StringEscapeUtils.unescapeCsv("\"foo.bar\""));
}

代码示例来源:origin: org.apache.nifi/nifi-standard-processors

private LinkedHashSet<String> attributeListStringToSet(String attributeList) {
  //take the user specified attribute list string and convert to list of strings.
  LinkedHashSet<String> result = new LinkedHashSet<>();
  if (StringUtils.isNotBlank(attributeList)) {
    String[] ats = attributeList.split(SPLIT_REGEX);
    for (String str : ats) {
      result.add(StringEscapeUtils.unescapeCsv(str.trim()));
    }
  }
  return result;
}

相关文章