我想做一个可以以单词为单位的排序如
INPUT : I am a good student but not a good boy
OUTPUT : a a am boy but good good I not student
是以字典顺序排列单词
要能处理至少1000个单词
我考虑的使用Memo来进行输入输出
请大家给点意见 谢谢
...全文
361打赏收藏
请教大家
我想做一个可以以单词为单位的排序如 INPUT : I am a good student but not a good boy OUTPUT : a a am boy but good good I not student 是以字典顺序排列单词 要能处理至少1000个单词 我考虑的使用Memo来进行输入输出 请大家给点意见 谢谢
var
str_lst : TStringList;
begin
s a:='I am a good student but not a good boy';
str_lst := tstringlist.create;
while s<>'' do
str_lst.Add(copy(s, 1, pos(' ', s)));
s := copy(s, pos(' ', s)+1, 65535);
end;
ListBox1.Items.Assign(str_lst);
ListBox1.Sorted := true;
str_lst.Free;
end;