質問編集履歴

2

コードの改変

2019/08/05 04:22

投稿

sekaikan_ozaki
sekaikan_ozaki

スコア65

test CHANGED
File without changes
test CHANGED
@@ -74,13 +74,13 @@
74
74
 
75
75
  for (int j = 0; j < timeList.size(); j++) {//CSVの要素を回す
76
76
 
77
- time = timeList.get(j);
77
+ if (timeList.get(j).startsWith(text)) {//前方一致したら
78
78
 
79
- if (time.startsWith(text)) {//前方一致したら
79
+ textView.setText(timeList.get(j));
80
-
81
- //処理
82
80
 
83
81
  matchCount++;
82
+
83
+ break;
84
84
 
85
85
  }
86
86
 
@@ -98,9 +98,11 @@
98
98
 
99
99
  for (int c = 0; c < tempList.size(); c++) {//CSVの要素を回す
100
100
 
101
- if (tempList.get(c).equals(temp)) {//完全一致したら
101
+ if (tempList.get(c).equals(temp)) {//完全一致
102
102
 
103
+ textView.setText(timeList.get(j));
104
+
103
- //処理
105
+ break;
104
106
 
105
107
  }
106
108
 

1

ソースコードの追記

2019/08/05 04:22

投稿

sekaikan_ozaki
sekaikan_ozaki

スコア65

test CHANGED
File without changes
test CHANGED
@@ -58,4 +58,66 @@
58
58
 
59
59
 
60
60
 
61
+ ```java
62
+
63
+ //入力された日本語と適合する日本語を探して、対応する言語を表示するメソッド
64
+
65
+ public void match(String text) {
66
+
67
+
68
+
69
+
70
+
71
+ int matchCount = 0;
72
+
73
+
74
+
75
+ for (int j = 0; j < timeList.size(); j++) {//CSVの要素を回す
76
+
77
+ time = timeList.get(j);
78
+
79
+ if (time.startsWith(text)) {//前方一致したら
80
+
81
+ //処理
82
+
83
+ matchCount++;
84
+
85
+ }
86
+
87
+ }
88
+
89
+
90
+
91
+
92
+
93
+ //~~~~~~~~~~~
94
+
95
+
96
+
97
+ if(matchCount == 1) {
98
+
99
+ for (int c = 0; c < tempList.size(); c++) {//CSVの要素を回す
100
+
101
+ if (tempList.get(c).equals(temp)) {//完全一致したら
102
+
103
+ //処理
104
+
105
+ }
106
+
107
+ }
108
+
109
+ }
110
+
111
+
112
+
113
+
114
+
115
+ }
116
+
117
+
118
+
119
+ ```
120
+
121
+
122
+
61
123
  これを直す方法はあるのでしょうか?