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


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

Re: comma-separated floats

Path csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!nx01.iad01.newshosting.com!newshosting.com!69.16.185.16.MISMATCH!npeer02.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!post01.iad.highwinds-media.com!newsfe10.iad.POSTED!83aa503d!not-for-mail
From Daniel Pitts <newsgroup.nospam@virtualinfinity.net>
User-Agent Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:6.0.2) Gecko/20110902 Thunderbird/6.0.2
MIME-Version 1.0
Newsgroups comp.lang.java.programmer
Subject Re: comma-separated floats
References <d27f3e79-81e1-4218-abcb-28b342033e08@dk6g2000vbb.googlegroups.com>
In-Reply-To <d27f3e79-81e1-4218-abcb-28b342033e08@dk6g2000vbb.googlegroups.com>
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
Lines 14
Message-ID <3Bmiq.2435$pH6.1554@newsfe10.iad> (permalink)
X-Complaints-To abuse@newsrazor.net
NNTP-Posting-Date Mon, 03 Oct 2011 17:49:51 UTC
Date Mon, 03 Oct 2011 10:49:51 -0700
Xref x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:8494

Show key headers only | View raw


On 10/3/11 10:36 AM, 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 = ?

Easiest is to use String.split(","), and then Float.parseFloat() on each 
value in the array returned from String.split(), storing it into the 
array you created and stored variable in f.

Hope this helps, and good luck.

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