Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.help > #936

Re: Q) Parsing Command-Line Arguments

From Roedy Green <see_website@mindprod.com.invalid>
Newsgroups alt.comp.lang.java, comp.lang.java.help, comp.sources.d
Subject Re: Q) Parsing Command-Line Arguments
Date 2011-08-09 09:52 -0700
Organization Canadian Mind Products
Message-ID <n9p247p56jbrgoftquodumn1m3a832i3ob@4ax.com> (permalink)
References <6af59288-146e-46ae-8ec9-e5fab5b9f27c@y16g2000yqh.googlegroups.com>

Cross-posted to 3 groups.

Show all headers | View raw


On Tue, 9 Aug 2011 05:28:36 -0700 (PDT), Proud Japanese
<hayato.fujimoto@yahoo.com> wrote, quoted or indirectly quoted someone
who said :

>I see that there are two ways to parse command line arguments.  For
>example,
>
>        double d1 = Double.valueOf(args[0]).doubleValue() ;
>        double d2 = Double.parseDouble(args[0]);
>
>Is there a difference between these two options?  Personally I think
>that the second option is simpler.
>
>Which one is more preferable?

Those are conversion techniques, nothing to do with parsing the
command line. The library code that calls main does the parse.

See http://mindprod.com/applet/conversion.html

It will show you how to convert any of the basic types into any of the
others.  It shows multiple ways sometimes, with notes on the
advantages of each.  In general, the one I consider generally best is
at the top.

-- 
Roedy Green Canadian Mind Products
http://mindprod.com
Most of computer code is for telling the computer
what do if some very particular thing goes wrong. 

Back to comp.lang.java.help | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Q) Parsing Command-Line Arguments Proud Japanese <hayato.fujimoto@yahoo.com> - 2011-08-09 05:28 -0700
  Re: Q) Parsing Command-Line Arguments markspace <-@.> - 2011-08-09 07:50 -0700
  Re: Q) Parsing Command-Line Arguments Roedy Green <see_website@mindprod.com.invalid> - 2011-08-09 09:52 -0700
  Re: Q) Parsing Command-Line Arguments Lew <lewbloch@gmail.com> - 2011-08-10 10:10 -0700
    Re: Q) Parsing Command-Line Arguments Lew <lewbloch@gmail.com> - 2011-08-10 16:34 -0700

csiph-web