Janilabo

number

Aug 3rd, 2013
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 1.18 KB | None | 0 0
  1. function MultiBetween(str, s1, s2: string): TStringArray;
  2. var
  3.   strL, s1L, s2L, o, n, e, r: Integer;
  4. begin
  5.   s1L := Length(s1);
  6.   s2L := Length(s2);
  7.   strL := Length(str);
  8.   if ((s1 <> '') and (s2 <> '') and (strL > (s1L + s2L))) then
  9.   begin
  10.     SetLength(Result, (strL - (s1L + s2L)));
  11.     repeat
  12.       n := PosEx(s1, str, (n + 1));
  13.       if (n < 1) then
  14.         Break;
  15.       e := PosEx(s2, str, (n + 1));
  16.       if (e < 1) then
  17.         Break;
  18.       repeat
  19.         o := n;
  20.         n := PosEx(s1, str, (n + 1));
  21.       until ((n >= e) or (n < 1));
  22.       n := o;
  23.       Result[r] := Between(s1, s2, Copy(str, n, (s1L + (e + s2L))));
  24.       if (Result[r] <> '') then
  25.         Inc(r);
  26.     until ((e < 1) or (n < 1));
  27.   end;
  28.   SetLength(Result, r);
  29. end;
  30.  
  31. function GetThatNumber(page: string): string;
  32. var
  33.   TSA: TStringArray;
  34.   str: string;
  35. begin
  36.   str := Between('Attack', '</tr>', GetPage(page));
  37.   TSA := MultiBetween(str, '<td align="right">', '</td>');
  38.   if (High(TSA) > 0) then
  39.     Result := TSA[1]
  40.   else
  41.     Result := '';
  42.   SetLength(TSA, 0);
  43. end;
  44.  
  45. begin
  46.   WriteLn(GetThatNumber('http://services.runescape.com/m=hiscore_oldschool/hiscorepersonal.ws?user1=n6p'));
  47. end.
Advertisement
Add Comment
Please, Sign In to add comment