Accepting parameters from console

Hi all,

I have a console based application. The user would pass several parameters from the command line. The problem is some of them are optional and there is no fixed order in which they would be supplied so i have a really big if else statement. Just wanted to know if there is any better way of handeling this.

I take around 25 parameters from the command line.

Thanks in advance

Praveen

[422 byte] By [alvandipa] at [2007-11-27 9:12:27]
# 1
Try using regex...
@@CKM@@a at 2007-7-12 21:58:58 > top of Java-index,Java Essentials,Java Programming...
# 2

On one hand, a long if ... else if construct doesn't sound too bad i my ears. Are you placing it inside a loop?

Somebody else's bound to have had this problem before you, so it may be worth searching the net for software that will help you. I don't know if there is anything, I just wouldn't be the slightest bit surprised if there is.

Whether there are other options for writing your own handling from scratch, I'd rather not make suggestions when I don't know what your parameters look like. Maybe you'll want to describe the format for us?

Also, how keen are you on checking the validity of the parameters passed? I'd find it worth doing myself, especially if they will be typed in by hand when your program is called. And how much work will that take?

OleVVa at 2007-7-12 21:58:58 > top of Java-index,Java Essentials,Java Programming...