如何删除“ "来自java中字符串的字符? [英] How to remove " " charecter from string in java?

查看:386
本文介绍了如何删除“ "来自java中字符串的字符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好

我写这段代码删除?来自字符串。

但是当我在xml文件中写入时它存在吗?

.replaceAll不起作用?



我尝试过:



hello
i write this code for remove "" from string.
but when i write in xml file it exist?
the .replaceAll not work?

What I have tried:

org.jsoup.nodes.Document doc =  Jsoup.parse(rs.getString("flds"));
                org.jsoup.nodes.Document doc1 =  Jsoup.parse(rs.getString("sfld"));
                System.out.println(doc.getElementsByTag("img").attr("src"));
                String front=doc1.text();
                String back=doc.text().replaceAll("","");

推荐答案

可能没有正确地从您的代码字符串中翻译它。最好使用字符代码。



该字符的十六进制代码是%1F所以..



Maybe it isn't being translated from your code string properly. Best to use the char code.

The hex code for that char is "%1F" so..

int charInt = 0x1F;



然后


and then

char c = (char)charInt;



这可以直接插入到您的代码中




This can then be inserted directly into your code

org.jsoup.nodes.Document doc =  Jsoup.parse(rs.getString("flds"));
                org.jsoup.nodes.Document doc1 =  Jsoup.parse(rs.getString("sfld"));
                System.out.println(doc.getElementsByTag("img").attr("src"));
                String front=doc1.text();
                String back=doc.text().replaceAll(String.valueOf(c),"");





我无法测试这个,但我希望它有帮助



I have no means to test this, but I hope it helps


这篇关于如何删除“ "来自java中字符串的字符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆