回答編集履歴

2

エラー修正

2020/04/15 15:02

投稿

tkanda
tkanda

スコア2425

test CHANGED
@@ -6,10 +6,12 @@
6
6
 
7
7
  String hoge = "[こんにちは, こんばんは]";
8
8
 
9
- System.out.println(hoge.replace("^[","").replace("]$","").replaceAll(",\s*", System.lineSeparator()));
9
+ System.out.println(hoge.replaceAll("^\[","").replaceAll("\]$","").replaceAll(",\s*", System.lineSeparator()));
10
10
 
11
11
  }
12
12
 
13
13
  }
14
14
 
15
15
  ```
16
+
17
+ 失礼しました。エラー出てましたので修正版を再掲します。

1

修正

2020/04/15 15:02

投稿

tkanda
tkanda

スコア2425

test CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  String hoge = "[こんにちは, こんばんは]";
8
8
 
9
- System.out.println(hoge.replaceAll(",\s*", System.lineSeparator()));
9
+ System.out.println(hoge.replace("^[","").replace("]$","").replaceAll(",\s*", System.lineSeparator()));
10
10
 
11
11
  }
12
12