| Код | function GetCode(AURL: string): string; var lPos: Integer; begin Result := ''; lPos := Pos('?', AURL); if lPos <= 0 then Exit; Inc(lPos); while (lPos <= Length(AURL)) and (AURL[lPos] >= '0') and (AURL[lPos] <= '9') do Result := Result + AURL[lPos] end;
|
Писал в браузере - сильно не пинать. Соответственно - не оптимизировал. Можно проще - найти начало кода (?) и окончание ("), а после скопировать все между ними:| Код | function GetCode(AURL: string): string; var lPos1, lPos2: Integer; begin Result := ''; lPos1 := Pos('?', AURL); lPos2 := Pos('"', AURL); if (lPos1 > 0) and (lPos2 > 0) and (lPos2 > lPos1) then Result := Copy(AURL, lPos1 + 1, lPos2 - lPos1 - 2); end;
|
|