gpt4 book ai didi

java - 使用java替换字符串中的字符

转载 作者:行者123 更新时间:2023-12-01 17:35:15 25 4
gpt4 key购买 nike

我需要使用java替换字符串中的字符。我尝试在字符串类中使用替换函数,但它不起作用。

需要删除下面给出的公共(public)部门旁边的双引号

null,לוד נמל תעופה,ISRAEL AIRPORTS AUTHORITY,null,Public Sector,נתב\"ג,XX400017791,,2,false,400017791,null,Account Register,null,null,11688,ISRAEL AIRPORTS AUTHORITY,null,2019-08-21T09:11:25,null,false,UKIIMEA,null,null,70100

谁能帮我找到可能的解决方案。

代码:

String csv = "null,לוד נמל תעופה,ISRAEL AIRPORTS AUTHORITY,null,Public Sector,נתב\\\"ג,XX400017791,,2,false,400017791,null,Account Register,null,null,11688,ISRAEL AIRPORTS AUTHORITY,null,2019-08-21T09:11:25,null,false,UKIIMEA,null,null,70100";
csv = csv.replace("\"", "");

System.out.println(csv);

最佳答案

试试这个:

String csv = "null,לוד נמל תעופה,ISRAEL AIRPORTS AUTHORITY,null,Public Sector,נתב\\\"ג,XX400017791,,2,false,400017791,null,Account Register,null,null,11688,ISRAEL AIRPORTS AUTHORITY,null,2019-08-21T09:11:25,null,false,UKIIMEA,null,null,70100";

csv = csv.replace("\"", "").replace("\\","");
System.out.println(csv);

输出:

null,לוד נמל תעופה,ISRAEL AIRPORTS AUTHORITY,null,Public Sector,נתבג,XX400017791,,2,false,400017791,null,Account Register,null,null,11688,ISRAEL AIRPORTS AUTHORITY,null,2019-08-21T09:11:25,null,false,UKIIMEA,null,null,70100

关于java - 使用java替换字符串中的字符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61054214/

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