Results 1 to 4 of 4

Thread: Help!

  1. #1
    Join Date
    Oct 2007
    Posts
    742
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Help!

    I made it so scar gets item prices from the runescape site, it finds the item prices and it always returns like this: 'xxx '
    I want scar to automaticly remove the space in 'xxx ' so i can make scar use StrToInt.

    Pl0x help.
    Woot woot.

  2. #2
    Join Date
    Nov 2007
    Location
    Chile
    Posts
    1,901
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    SCAR Code:
    Left(Str, Length(Str) - 1)
    Replace Str with your string.


  3. #3
    Join Date
    Sep 2006
    Location
    New Jersey, USA
    Posts
    5,347
    Mentioned
    1 Post(s)
    Quoted
    3 Post(s)

    Default

    Or you could
    SCAR Code:
    Trim(Input); //Removes spaces at beginning and end of string

    or

    SCAR Code:
    Replace(Input, ' ', ''); //Removes all spaces in string
    Interested in C# and Electrical Engineering? This might interest you.

  4. #4
    Join Date
    Feb 2007
    Location
    Access Violation at 0x00000000
    Posts
    2,865
    Mentioned
    3 Post(s)
    Quoted
    18 Post(s)

    Default

    You mean a function like this:
    SCAR Code:
    {*******************************************************************************
    Function GetGEPrice(MidMinMax : String; id : Integer): Integer;
    By: Floor66
    Description: Gets the Mid/Min/Max price out of G.E with the specified item ID
    *******************************************************************************}


    Function GetGEPrice(MidMinMax : String; id : Integer): Integer;
    Var
      S, I : String;
    Begin
      S := GetPage('http://itemdb-rs.runescape.com/viewitem.ws?obj='+ IntToStr(id)); //Get the page
      If S = '' Then
      Begin
        WriteLn('GetGEPrice: Failed to open webpage!');
        Exit;
      End;
      Case MidMinMax Of // Mid, min or max price, take out of the page source
        'Mid', 'mid': I := Between('<b>Market price:</b> ', '</span>', S);
        'Min', 'min': I := Between('<b>Minimum price:</b> ', '</span>', S);
        'Max', 'max': I := Between('<b>Maximum price:</b> ', '</span>', S);
      End;
      Delete(I, High(I), 1); // Removes the LINE-BREAK that is actually after it:
                             // <b>Market price:</b> 123 (broken here)
                             // </span>
      I := Replace(I, 'k', '00');
      I := Replace(I, 'm', '00000');
      I := Replace(I, '.', '');
      I := Replace(I, ',', '');
      I := Trim(I);
      Result := StrToInt(I);
    End;

    Anyways, I also needed to use Delete(); for 1 extra space.
    Ce ne sont que des gueux


Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •