![]() |
|
#6
|
||||
|
||||
![]() Цитата:
function PolStr(s : string;n : integer;c : Char) : string; var i,count,nac,kol : integer; sbor : boolean; begin if n = 1 then sbor := true else sbor := false; count := 0;nac := 0; kol := 1; for i := 0 to length(s)+1 do begin if sbor then begin if s[i] = c then break else count := count + 1; Continue; end; nac := nac + 1; if s[i] = c then begin kol := kol + 1; if kol = n then sbor := true; end; end; if n = 1 then Result := Copy(s,nac,count-1) else Result := Copy(s,nac,count); end; Первым параметром строка, вторым номер выделяемой части в твоём случае 1 третий - символ разделитель у тебя - '|' --------------------------------------------- Программирование - не профессия, а стиль жизни |