Topic is
Use methods to achieve: have an array of strings: {" Malone ", "Michael Jordan", "ray," Jimmy, "Tim Duncan," kobe Bryant "}, please output the longest string,
CodePudding user response:
The method of preliminary simple:According to the circular array length, the length of each subscript data, then compare:
Const
CStr: TArray
Var
I, Y: integer;
VLen:=0;
Y:=1;
If I=0 to Length (cStr) then
The begin
If vLen
VLen:=Length (cStr [I]);
Y:=I;
end;
end;
Finally vLen is the longest of the length of the string, yy is the longest string of subscript, cStr [y] is the longest string of contents of the string