Does anyone know if the above can be used to extract flags from a list of command line arguments? For example, if someone started my app using this command line:-

MyApp -L -D hello goodbye

I could extract the parameters hello and goodbye - but how can I discover that 2 flags preceded them?