Только добавь Trim, т.к. может быть несколько пробелов (лишних)
Цитата:
Сообщение от dr. F.I.N.
Код:
function GroupLength(Source: String): Integer;
var
i, tmp: Integer;
begin
Source := Trim(Source); // удаляем лишние пробелы
Result := 0;
if Length(Source) = 0 then Exit;
tmp := 0;
for i := 1 to Length(Source) do
if Source[i] in ['0'..'1'] then Inc(tmp)
else
begin
if tmp > Result then Result := tmp;
tmp := 0;
end;
if tmp > Result then Result := tmp;
end;
|