【发布时间】:2011-04-04 20:10:15
【问题描述】:
我需要有关如何存储句子中出现的特定单词的索引的帮助。 我需要将索引存储在一个数组中,以便以后可以访问它。我正在使用 while 循环,但它不起作用。
while (index > 0) {
for (int i = 0; i < data.length; i++) {
data[i] = index;
}
System.out.println("Index : " + index);
index = input.indexOf(word, index + word.length());
}
【问题讨论】:
-
您能否详细说明您正在尝试完成什么、您希望数据保存什么以及初始化为什么索引?
-
@Stephen L: here's the original question.