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


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

Re: comma-separated floats

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!.POSTED!not-for-mail
From Roedy Green <see_website@mindprod.com.invalid>
Newsgroups comp.lang.java.programmer
Subject Re: comma-separated floats
Date Mon, 03 Oct 2011 11:38:33 -0700
Organization Canadian Mind Products
Lines 25
Message-ID <j50k87lccua3v12ufps274tqhhnetr9vl6@4ax.com> (permalink)
References <d27f3e79-81e1-4218-abcb-28b342033e08@dk6g2000vbb.googlegroups.com>
Reply-To Roedy Green <see_website@mindprod.com.invalid>
NNTP-Posting-Host RCd/Ul4tyxGUBII8WGwa5g.user.speranza.aioe.org
Mime-Version 1.0
Content-Type text/plain; charset=us-ascii
Content-Transfer-Encoding 7bit
X-Complaints-To abuse@aioe.org
X-Notice Filtered by postfilter v. 0.8.2
X-Newsreader Forte Agent 6.00/32.1186
Xref x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:8500

Show key headers only | View raw


On Mon, 3 Oct 2011 10:36:29 -0700 (PDT), bob <bob@coolgroups.com>
wrote, quoted or indirectly quoted someone who said :

>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 = ?

You can read a file like that or a StringInputStream) with CSV.  See
http://mindprod.com/jgloss/csv.html

You can also use Pattern split then parseFloat.
see http://mindprod.com/jgloss/regex.html
-- 
Roedy Green Canadian Mind Products
http://mindprod.com
It should not be considered an error when the user starts something
already started or stops something already stopped. This applies
to browsers, services, editors... It is inexcusable to 
punish the user by requiring some elaborate sequence to atone,
e.g. open the task editor, find and kill some processes.

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