Results 1 to 6 of 6

Thread: Remove a value from an Array;

  1. #1
    Join Date
    Jan 2008
    Location
    Ontario, Canada
    Posts
    7,805
    Mentioned
    5 Post(s)
    Quoted
    3 Post(s)

    Default Remove a value from an Array;

    How would I do that...?

    Its not a static array before anyone calls me dumb.

    Nava2
    Writing an SRL Member Application | [Updated] Pascal Scripting Statements
    My GitHub

    Progress Report:
    13:46 <@BenLand100> <SourceCode> @BenLand100: what you have just said shows you 
                        have serious physchological problems
    13:46 <@BenLand100> HE GETS IT!
    13:46 <@BenLand100> HE FINALLY GETS IT!!!!1

  2. #2
    Join Date
    Mar 2007
    Posts
    3,116
    Mentioned
    0 Post(s)
    Quoted
    2 Post(s)

    Default

    SCAR Code:
    Procedure RemoveValue(var Arr:TIntegerArray; Index:Integer);
    var
      I:Integer;
    begin
      for I:= Index to High(Arr) do
        Arr[Index]:=Arr[Index+1];
      SetarrayLength(Arr, High(Arr))
    end;

  3. #3
    Join Date
    Jan 2008
    Location
    Ontario, Canada
    Posts
    7,805
    Mentioned
    5 Post(s)
    Quoted
    3 Post(s)

    Default

    Quote Originally Posted by Mylesmadness View Post
    SCAR Code:
    Procedure RemoveValue(var Arr:TIntegerArray; Index:Integer);
    var
      I:Integer;
    begin
      for I:= Index to High(Arr) do
        Arr[Index]:=Arr[Index+1];
      SetarrayLength(Arr, High(Arr))
    end;
    You just write that? If you did rep, if not then.. well thanks for showing me!

    Nava2
    Writing an SRL Member Application | [Updated] Pascal Scripting Statements
    My GitHub

    Progress Report:
    13:46 <@BenLand100> <SourceCode> @BenLand100: what you have just said shows you 
                        have serious physchological problems
    13:46 <@BenLand100> HE GETS IT!
    13:46 <@BenLand100> HE FINALLY GETS IT!!!!1

  4. #4
    Join Date
    Jun 2006
    Posts
    3,861
    Mentioned
    3 Post(s)
    Quoted
    1 Post(s)

    Default

    Or, if you don't need to keep it in order, this is a faster way:
    SCAR Code:
    procedure RemoveElement(var A: TIntegerArray; Index: Integer);
    begin
      Swap(A[Index], A[High(A)]);
      SetLength(A, High(A));
    end;

  5. #5
    Join Date
    Mar 2007
    Posts
    3,116
    Mentioned
    0 Post(s)
    Quoted
    2 Post(s)

    Default

    Quote Originally Posted by Nava2 View Post
    You just write that? If you did rep, if not then.. well thanks for showing me!

    Nava2
    Yes I wrote that

  6. #6
    Join Date
    Jul 2007
    Location
    Ottawa, Canada
    Posts
    930
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    OOOh! that is clever sexyness!!!

    (but .net is cleverer)
    ~ Metagen

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Array in an array...
    By Lorax in forum OSR Advanced Scripting Tutorials
    Replies: 20
    Last Post: 01-16-2010, 09:10 PM
  2. ItemColors: Array of Array of Integer
    By n3ss3s in forum Research & Development Lounge
    Replies: 5
    Last Post: 10-30-2007, 06:04 PM
  3. Array of Tbox - And TPoint array helps.
    By R0b0t1 in forum OSR Help
    Replies: 4
    Last Post: 06-10-2007, 06:43 PM

Posting Permissions

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