开发者

java gnu getopt - how to make it case insensitive?

I'm using gnu's getopt library for java. How can I make the long opts to be case insensitive? i.e. I want --switch to be treated like --Switch. The default behavior seems to be case sensitive, and开发者_JAVA百科 I failed to find the place to define otherwise.

Thanks


getopt is written by and (mostly) for linux CLI programs. Linux is a case-sensitive operating system. In short get-opt does not supply this functionality. HOWEVER, you can work around this.

Only specify options in UPPERCASE. Before you pass your String[]args to getopt, loop over it and convert all options that AREN'T ARGUMENTS (e.g. start with - or --) to UPPERCASE.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜