gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-11-29 03:41:48 24 4
gpt4 key购买 nike

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/

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