私のメソッド実行後に "、" - カンマを削除しようとしています。メソッドの後に誰かが "、"を取り除く方法を教えてくれますか?コンマメソッドを削除するjava
String.replaceAll(",", "\n");
またはあなたの場合:
public String toString(){
String bob ="";
for(Person p : bcc){
bob+= p.getName() + " is friends with ";
for(Person fOfp : p.getFriendList()){
bob+= fOfp.getName() +", ";
}
bob+="\n"; --i want to add here to remove the " , "
}
return bob;
}