Results 1 to 3 of 3

Thread: [RESOLVED] [2008] remove element from array

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Feb 2006
    Posts
    607

    Resolved [RESOLVED] [2008] remove element from array

    I have this very simple question and for the life of me i can't even google it right.

    Code:
            Dim params() As String = args
           
            For Each parameter In params
                If parameter.StartsWith("-") Then
                       Options.Add(parameter)
                End If
            Next
    pretty much I am creating a command line program. It will accept arguments so someone can type in

    Code:
    prog.exe blah blah -t -f -v
    All i want it so get the params that start with - and store them in my Options (list of string).
    then I want to delete them from the orignal array so I am only left with "blah blah"

  2. #2

    Thread Starter
    Fanatic Member
    Join Date
    Feb 2006
    Posts
    607

    Re: [RESOLVED] [2008] remove element from array

    I decided that I would get the arguments and store it in a list right away
    Code:
    Dim _argsList as list (of string)
    _argsList = args.ToList

  3. #3
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,424

    Re: [RESOLVED] [2008] remove element from array

    that'd be easier

Posting Permissions

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



Click Here to Expand Forum to Full Width