所以我有一个看起来像这样的数组:
var questans = new String[10, 2];
questans[0,0]="Hey How's it going?";
questans[0,1]="You know me Just chillin'";
questans[1,0]="Hello there friend";
questans[1,1]="Well met to you too!";
questans[2,0]="I like chocolate pudding";
questans[2,1]="Good for you";
我需要从中提取所有单词。我尝试编写一个 for 循环,但它一直给我一些奇怪的错误。
我目前已经编写代码来查找不同单词的总数:
var ff: String[questans.Length]; //Returned string array
var linenumber = 0; //Current line, 0-index
var spacecount = 0; //Current space in current line, 0-index
for (var line in questans) {
for (var spaceSplit in line.Split(" ")) {
ff[linenumber, spacecount] = spaceSplit[spacecount];
spacecount++;
}
spacecount = 0;
linenumber++;
}
但是我在从上面给出的数组中获取所有单词时遇到问题。请帮我解决这个问题。