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


Groups > comp.lang.java.programmer > #8532

Re: comma-separated floats

Newsgroups comp.lang.java.programmer
From Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at>
Subject Re: comma-separated floats
References <d27f3e79-81e1-4218-abcb-28b342033e08@dk6g2000vbb.googlegroups.com> <j6cuvn$2fk$1@dont-email.me> <21508759.1902.1317742836345.JavaMail.geo-discussion-forums@prfp13>
Message-ID <slrnj8md0j.6gl.avl@gamma.logic.tuwien.ac.at> (permalink)
Date 2011-10-04 16:28 +0000

Show all headers | View raw


Lew <lewbloch@gmail.com> wrote:
> markspace wrote:
>>  bob wrote:
>>> What is the easiest way to convert a bunch of comma-separated floats
>>> into float[]?
>>> String s =
>>> "5.792327,13.093715,-1.47686,15.495049,12.842123,-2.455942,1.326654,12.842123,0.000000";
>>> float[] f = ?
>> Perhaps something like
>> Scanner scanner = new Scanner( s );
>> scanner.useDelimeter( "," );
> Uh-uh.  'scanner.useDelimiter( "," );'
><http://download.oracle.com/javase/7/docs/api/java/util/Scanner.html#useDelimiter(java.lang.String)>

I followed the Link, but couldn't find anything "Uh-oh"-worthy.

Is the String-variant of it really that "Uh-oh"-ish?
Isn't scanner.useDelimiter( Pattern.compile(",") ) very likely
to be merely a case of pre-mature optimization to the cost of
making the code a bit more complicated? Especially as it isn't
even happening in the innermost loop...

Or did I miss something else?

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


Thread

comma-separated floats bob <bob@coolgroups.com> - 2011-10-03 10:36 -0700
  Re: comma-separated floats Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2011-10-03 10:49 -0700
  Re: comma-separated floats markspace <-@.> - 2011-10-03 11:30 -0700
    Re: comma-separated floats Lew <lewbloch@gmail.com> - 2011-10-04 08:40 -0700
      Re: comma-separated floats Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2011-10-04 16:28 +0000
        Re: comma-separated floats markspace <-@.> - 2011-10-04 10:44 -0700
  Re: comma-separated floats Roedy Green <see_website@mindprod.com.invalid> - 2011-10-03 11:38 -0700
  Re: comma-separated floats Jerry <jerry.bowman@gmail.com> - 2011-10-17 21:05 -0700

csiph-web