【发布时间】:2017-06-01 02:54:41
【问题描述】:
公共类 DemoWebBrowser { 公共静态 void main(String args[]) {
String answer = "A. hold - read";
String answerQuestion = "";
String[] arrStr1 = answer.split("\\.");
String str1 = arrStr1[1];
String[] Str2 = str1.split("-");
answerQuestion = "Jeff _____ a book right now, he _____ a story to Linda.";
for (int i = 1 ; i < Str2.length +1 ; i++){
answerQuestion = answerQuestion.replaceFirst("_____",Str2[(i-1)]);
}
System.out.println( answerQuestion);
}
}
问题出在哪里?我该如何解决?
【问题讨论】:
-
跟安卓有什么关系?
-
提供无效的细节。
-
那么,什么不起作用?另外,清理你的缩进。
-
我想从字符串“Jeff _____ 现在一本书,他 _____ 给 Linda 讲一个故事”中替换元素“______”。由从字符串 "A. hold - read" 中拆分出来的多个元素组成。我像上面一样编码,但它在 android studio 中不起作用,但当我检查时它在 eclipse 中起作用。