java - 如何在字符串中的 "| "之后在新行中打印数据

标签 java android

map.put("RowID", String.valueOf(RowID));
map.put(KEY_NAME, parser.getValue(e, KEY_NAME));

解析后我正在获取数据

13/2012 | Section 10(15), item (h) of sub-clause (iv) of the Income-tax Act, 1961 - Exemptions - Interest on bonds/debentures - Notified bonds/debentures of Public Sector Companies - Corrigendum to notification no.7/2012, dated 14-2-2012

我想在 | 之后分开并像那样打印数据

13/2012 Section
10(15), item (h) of sub-clause (iv) of the Income-tax Act, 1961 - Exemptions - Interest on bonds/debentures - Notified bonds/debentures of Public Sector Companies - Corrigendum to notification no.7/2012, dated 14-2-2012

我该怎么做?

最佳答案

使用 String.replace()。

例如:

    String s = "hello | world";

    System.out.println(s.replace("|", "\n"));

打印出来:

你好
世界

关于java - 如何在字符串中的 "| "之后在新行中打印数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12815063/

相关文章:

android - 如何以编程方式在 ListBox 项中添加图像?

java - 如何将函数引用传递到我的方法中并使用它们?

java - MyEclipse运行几分钟后崩溃(java已启动但​​返回退出代码-1073741819)

java - Brent Aurelie Flappy Bird 教程后的播放按钮高度

Android 显示星期几

android - 如何优雅地关闭辅助 Activity ?

java - Spring MVC 无效日期格式错误消息未显示

java - 简单 HelloWorld 上的 ClassNotFoundException

java - 如何在 Docker 中对 Web 应用程序进行分区

java - 使用方法引用的 Kotlin setOnClickListener 不起作用