相关文章推荐
暴躁的石榴  ·  翻译 - Dolibarr ERP CRM ...·  7 月前    · 
不羁的饺子  ·  Debezium | Apache Flink·  7 月前    · 
礼貌的蛋挞  ·  C++ double free or ...·  2 年前    · 
骑白马的金针菇  ·  Stream ...·  3 年前    · 
有胆有识的玉米  ·  gcc - Prevent ...·  3 年前    · 
1
2
3
4
5
6
7
8
9
10
11
12
public class Main
{
public static void main ( String [ ] args )
{
String str = "A|B|C|D|E" ;
String regex = "\\|" ;
String replacement = ", " ;
str = str . replaceAll ( regex , replacement ) ;
System . out . println ( str ) ;
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
import org . apache . commons . lang3 . StringUtils ;
public class Main
{
public static void main ( String [ ] args )
{
String str = "A|B|C|D|E" ;
char ch = '|' ;
str = StringUtils . replaceChars ( str , ch , ',' ) ;
System . out . println ( str ) ;
}
}