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


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

Re: Operation in String to Double conversion

Newsgroups comp.lang.java.programmer
Date 2012-10-14 14:08 -0700
References <3a63483c-4322-4bfb-8c28-2d528bf48443@googlegroups.com> <k5f7gf$p6g$2@localhost.localdomain>
Message-ID <b9f3c86c-4871-45d0-914d-6b345667d892@googlegroups.com> (permalink)
Subject Re: Operation in String to Double conversion
From William Lopes <williamlopes.dev@gmail.com>

Show all headers | View raw


Em domingo, 14 de outubro de 2012 17h31min11s UTC-3, Martin Gregorie  escreveu:
> On Sun, 14 Oct 2012 12:39:18 -0700, William Lopes wrote:
> 
> 
> 
> > Hi guys!
> 
> > 
> 
> > So, I have to do a conversion between String and Double object, but my
> 
> > string is a mathematical operation like "100 + 10". Even when I make a
> 
> > conversion using NumberFormat.getInstance of "100 + 10", my result is
> 
> > 100.0 only.
> 
> > 
> 
> > I would like to do it without split my string of way manually.
> 
> >
> 
> Sounds like you need an mathematical expression parser. I don't think 
> 
> there's anything suitable in the standard classes. You can:
> 
> 
> 
> 1)see if there's a third party mathematical expression parser available
> 
> 
> 
> 2)use a compiler generator like Coco/R 
> 
>   http://www.ssw.uni-linz.ac.at/Research/Projects/Coco/
> 
>   to create one.
> 
> 
> 
> 3)attempt to roll your own from scratch.
> 
> 
> 
> If it was my problem I'd work down that list in the order shown unless 
> 
> there are constraints set, i.e. its an assignment that you are required 
> 
> to solve by yourself.
> 
> 
> 
> I've used Coco/R to generate an equivalent Java class that could handle 
> 
> the sort of expressions used in C preprocessor commands: it was dead easy 
> 
> once I understood how Coco/R works, but then again I had previously 
> 
> solved non-trivial problems with lex and yacc.
> 
> 
> 
> 
> 
> -- 
> 
> martin@   | Martin Gregorie
> 
> gregorie. | Essex, UK
> 
> org       |

Thank you, using the your keywords I achieved to find a that can help me.

See: http://www.objecthunter.net/tinybo/blog/articles/86

Ps.: I didn't still tested it.

Hugs.

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


Thread

Operation in String to Double conversion William Lopes <williamlopes.dev@gmail.com> - 2012-10-14 12:39 -0700
  Re: Operation in String to Double conversion Martin Gregorie <martin@address-in-sig.invalid> - 2012-10-14 20:32 +0000
    Re: Operation in String to Double conversion William Lopes <williamlopes.dev@gmail.com> - 2012-10-14 14:08 -0700
      Re: Operation in String to Double conversion markspace <-@.> - 2012-10-14 15:59 -0700
        Re: Operation in String to Double conversion William Lopes <williamlopes.dev@gmail.com> - 2012-10-14 17:45 -0700
        Re: Operation in String to Double conversion frank.asseg@gmail.com - 2012-10-15 11:18 -0700
          Re: Operation in String to Double conversion Daniele Futtorovic <da.futt.news@laposte-dot-net.invalid> - 2012-10-16 00:14 +0200
            Re: Operation in String to Double conversion frank.asseg@gmail.com - 2012-10-15 15:41 -0700
        Re: Operation in String to Double conversion frank.asseg@gmail.com - 2012-10-15 11:27 -0700
          Re: Operation in String to Double conversion Lew <lewbloch@gmail.com> - 2012-10-15 12:40 -0700
            Re: Operation in String to Double conversion frank.asseg@gmail.com - 2012-10-15 14:24 -0700
              Re: Operation in String to Double conversion Lew <lewbloch@gmail.com> - 2012-10-15 14:48 -0700
              Re: Operation in String to Double conversion Arved Sandstrom <asandstrom2@eastlink.ca> - 2012-10-15 19:14 -0300
                Re: Operation in String to Double conversion Arne Vajhoej <arne@vajhoej.dk> - 2012-10-17 16:58 -0400
              Re: Operation in String to Double conversion Arne Vajhoej <arne@vajhoej.dk> - 2012-10-17 17:02 -0400
            Re: Operation in String to Double conversion Arne Vajhoej <arne@vajhoej.dk> - 2012-10-17 17:13 -0400
              Re: Operation in String to Double conversion Eric Sosman <esosman@comcast-dot-net.invalid> - 2012-10-17 17:32 -0400
  Re: Operation in String to Double conversion Roedy Green <see_website@mindprod.com.invalid> - 2012-10-14 22:49 -0700
  Re: Operation in String to Double conversion "John B. Matthews" <nospam@nospam.invalid> - 2012-10-15 13:19 -0400
    Re: Operation in String to Double conversion Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-10-15 12:51 -0700
      Re: Operation in String to Double conversion "John B. Matthews" <nospam@nospam.invalid> - 2012-10-16 09:39 -0400
  Re: Operation in String to Double conversion Eric Sosman <esosman@comcast-dot-net.invalid> - 2012-10-15 20:47 -0400
  Re: Operation in String to Double conversion Arne Vajhoej <arne@vajhoej.dk> - 2012-10-17 16:54 -0400

csiph-web