質問編集履歴

2

誤字がありました

2018/10/23 07:25

投稿

woooo
woooo

スコア26

test CHANGED
File without changes
test CHANGED
@@ -24,7 +24,7 @@
24
24
 
25
25
  Pattern addressPattern = Pattern.compile("^.{2,3}?[都道府県]");
26
26
 
27
- Matcher matcher = addressPattern.matcher(row.getAddress1()); // 分割前住所
27
+ Matcher matcher = addressPattern.matcher(address); // 分割前住所
28
28
 
29
29
  matcher.find();
30
30
 

1

コードを変えました。

2018/10/23 07:25

投稿

woooo
woooo

スコア26

test CHANGED
File without changes
test CHANGED
@@ -12,9 +12,7 @@
12
12
 
13
13
 
14
14
 
15
-
16
-
17
- イメージ下記のようです。
15
+ こんな感じです。
18
16
 
19
17
  ```java
20
18
 
@@ -22,10 +20,24 @@
22
20
 
23
21
 
24
22
 
25
- // addressから都道府県を取得
23
+ // 住所1から都道府県と市区町村以降分割
24
+
25
+ Pattern addressPattern = Pattern.compile("^.{2,3}?[都道府県]");
26
+
27
+ Matcher matcher = addressPattern.matcher(row.getAddress1()); // 分割前住所
28
+
29
+ matcher.find();
26
30
 
27
31
 
28
32
 
29
- ………
33
+ String prefectures = matcher.group(); // 都道府県;
34
+
35
+ String city = matcher.replaceFirst(""); // 市区町村以降;
36
+
37
+
30
38
 
31
39
  ```
40
+
41
+
42
+
43
+ 都道府県の正規判定がまだです。