Java Array Remove removeFlagsFromArgs(String[] args)

Here you can find the source of removeFlagsFromArgs(String[] args)

Description

remove Flags From Args

License

Open Source License

Declaration

public static String[] removeFlagsFromArgs(String[] args) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.util.ArrayList;
import java.util.List;

public class Main {
    public static String[] removeFlagsFromArgs(String[] args) {
        List<String> ret = new ArrayList<String>();
        boolean removeNextArg = false;
        for (String argument : args) {
            if (argument.equals("-a")) {
                removeNextArg = true;//from   ww  w. ja  v  a2  s  .c  om
                continue;
            }
            if (removeNextArg) {
                removeNextArg = false;
                continue;
            }
            ret.add(argument);
        }
        return ret.toArray(new String[0]);
    }
}

Related

  1. removeFirst(String[] in)
  2. removeFirst(String[] strArr)
  3. removeFirstElementFromArray(T[] array)
  4. removeFirstTwoArgs(String[] args, int startIndex)
  5. removeFlag(String[] options, String flag)
  6. removeFrom(double[] source, int idx)
  7. removeFromArray(String remove, String array[])
  8. removeFromArray(String[] oldArray, String stringToRemove)
  9. removeId(byte[] in, Integer id)