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


Groups > comp.soft-sys.math.mathematica > #3083

Re: Is there ToNumber?

From ADL <alberto.dilullo@tiscali.it>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: Is there ToNumber?
Date 2011-06-12 09:07 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <it1vl4$b7d$1@smc.vnet.net> (permalink)
References <isnllk$n7b$1@smc.vnet.net> <201106090945.FAA06238@smc.vnet.net>

Show all headers | View raw


On 11 Giu, 12:52, "Dr. Peter Klamser" <klam...@googlemail.com> wrote:
> ... ToExpression["1+1"]
>
> One Hint: If you know a function in Mathematica like "ToString", you
> mentioned in your email, look in the help system in the section "see
> also", there you find ToExpression["1+1"].
>
> Kind regards
>
> Peter
>
> Am 11.06.2011 09:59, schrieb Ted Sariyski:
>
> > Hi,
> > Is there a built-in function which returns the numeric value of a string
> > (like ToString but inverse).  Currently I use mine function toNumber:
>
> >    ch = StringToStream[timeStr];
> >    timeNum = Read[ch, Number];
> >    Close[ch];
>
> > but I suspect there is easier way.
> > Thanks in advance,
> > --Ted
>
> --
> Mit freundlichen Gr en
>
> Uta&  Peter Klamser

The request is less trivial than ToExpression["1+1"] since, for
example, typical number format cannot be read into Mathematica without
the rather involved trick reported by Ted Sariyski. As an example,

ToExpression["1e3"]
==> e3


ch = StringToStream["1e3"];
timeNum = Read[ch, Number];
Close[ch];
timeNum
==> 1000

I feel this complication as rather unfortunate, unless I am also
missing a simpler way to read in numbers.

ADL

Back to comp.soft-sys.math.mathematica | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: How show axes labels with AxesOrigin->{0,0,0} in 3D? Murray Eisenberg <murray@math.umass.edu> - 2011-06-08 11:16 +0000
  Re: How show axes labels with AxesOrigin->{0,0,0} in 3D? Peter Breitfeld <phbrf@t-online.de> - 2011-06-09 09:45 +0000
  Is there ToNumber? Ted Sariyski <tsariysk@craft-tech.com> - 2011-06-11 07:59 +0000
    Re: Is there ToNumber? Albert Retey <awnl@gmx-topmail.de> - 2011-06-14 11:52 +0000
    How to extract a pattern Ted Sariyski <tsariysk@craft-tech.com> - 2011-06-15 11:20 +0000
    Re: Is there ToNumber? "Hans Michel" <hmichel@cox.net> - 2011-06-16 08:02 +0000
  Re: Is there ToNumber? "Dr. Peter Klamser" <klamser@googlemail.com> - 2011-06-11 10:52 +0000
  Re: Is there ToNumber? "Harvey P. Dale" <hpd1@nyu.edu> - 2011-06-12 09:07 +0000
  Re: Is there ToNumber? ADL <alberto.dilullo@tiscali.it> - 2011-06-12 09:07 +0000
  Re: Is there ToNumber? "Hans Michel" <hmichel@cox.net> - 2011-06-12 23:00 +0000
  Re: Is there ToNumber? "Dr. Peter Klamser" <klamser@googlemail.com> - 2011-06-12 23:01 +0000
  Re: Is there ToNumber? DrMajorBob <btreat1@austin.rr.com> - 2011-06-15 11:19 +0000
  Re: Is there ToNumber? Daniel Lichtblau <danl@wolfram.com> - 2011-06-15 11:19 +0000

csiph-web