假设我有两个字符串数组,名为'arrayone'和'arraytwo'我将如何按字母顺序(从A到Z)排序'arrayone',同时仍保持与第二个数组的关系.
如果你想知道'arrayone'和'arraytwo'是什么,1有姓氏,2有每个人的年龄.我的最终结果是将它添加到一个richedit.
场景示例:
Smith 25
Appleseed 32
Gibbs 45
Run Code Online (Sandbox Code Playgroud)
必须变成:
Appleseed 32
Gibbs 45
Smith 25
Run Code Online (Sandbox Code Playgroud)
请不要使用stringlist,将其保存在简单的数组和过程中.
更新:我切换到记录.
尝试这个代码没有用
for i := 0 to 26 do
for j := 0 to 26 do
if recordname.surname[j] > recordname.surname[j+1] then begin
line := recordname.surname[j];
line[j] := recordname.surname[j+1];
recordname.surname[j+1] := line;
end;
Run Code Online (Sandbox Code Playgroud)
它说不兼容的类型:'字符'和'字符串'
如何将一行文本(例如,Hello there*3)拆分为一个数组?之前的所有内容都*需要添加到第一个元素,之后的所有内容都*需要添加到第二个元素。我确定这是可能的。稍后我需要回忆一下,第一项和第二项必须相互关联
我正在使用德尔福 7。