简体   繁体   中英

Removing certain characters in a string

我想删除下面字符串中的等号。

String str = "[=Ind(\"Blr-ind\",\"Company\")]";

You can also use String.replaceAll() to replace all occurrences by any other String

String input = "[=Ind(\"Blr-ind\",\"Company\")]";
input = input.replaceAll("=", "");

System.out.println(input);

Use String.replaceFirst() on the string:

String input = "[=Ind(\"Blr-ind\",\"Company\")]";
input = input.replaceFirst("=", "");

System.out.println(input);

Output:

[Ind("Blr-ind","Company")]

just use the replace method :

String s = "[=Ind(\"Blr-ind\",\"C=ompany\")]";

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

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