简体   繁体   中英

How to delete a specific character from a string?

I'm reading some integer values from a webpage using Java through Jsoup library. In the website integer represented as xxx,xxx . I need this set of data to be written in a .csv file so later it can be accessed through Excel for further work.

How to remove this comma in the middle so it doesn't affect the .csv file?

string.replace(",", " "); should do it

   if you want to remove any charactor from a string you can use it.

   String name="sri,sha,ila,m";

   name = name.replace(",","");

   Output : srishailam 

当你得到它时它必须是一个字符串,所以可以使用firstInstanceOf来查找然后删除它

I believe that string.replace(",", "") will solve your problem. This question will help String not replacing characters .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM