File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes String recognition questions... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "String recognition questions... " Watch "String recognition questions... " New topic
Author

String recognition questions...

johny doe
Ranch Hand

Joined: Dec 07, 2007
Posts: 78
--------------------------------------------------------------------------------

i want to build a function that inputs

a string
and i want to recognize a complex polynomial
in that string and if
for example if the user inputs the folloing string

(1+i)x^3 +(5i)x^2 +(3+5i)x +5

(each cell in the complex number array consists of
a real number and emaginary)
the function will put in cell 3 the value 1 in the real part
of cell 3 and 1 in the imaginary part of cell 3.

in cell 2
it will put 0 in the real part of cell 2
and 5 in the complex part of cell 2

etc...

is there a way for me to make this function??

another questiob
if i got
a string
=================
a=\b
===============
for wich the user puts values for a and b
i want to make the following operation on the

t=a.divide(b)

how do i build a mechanism that recognises
this pattern??
Joanne Neal
Rancher

Joined: Aug 05, 2005
Posts: 3419
    
  12
There are a number of 3rd party libraries for parsing maths expressions. I've never used any, so can't recommend anything, but if you Google 'java math parser' you can take a look at a few and see if any meet your needs.


Joanne
johny doe
Ranch Hand

Joined: Dec 07, 2007
Posts: 78
i coundnt find the thing iwas looking for
can you be more specific
please
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18508
    
  40

Originally posted by johny doe:
i coundnt find the thing iwas looking for
can you be more specific
please


I followed Joanne's instructions, and typed "java math parser" into google. But let me check.... Yup, the first hit claims that it supports complex numbers too.

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
Nicholas Jordan
Ranch Hand

Joined: Sep 17, 2006
Posts: 1282
  • Developer Forums java string parsing
  • Parser (Java 2 Platform SE v1.4.2)
  • Lexical analysis and Java: Part 1 - Java World
  • A Simple Recursive Descent Parser


  • "The differential equations that describe dynamic interactions of power generators are similar to that of the gravitational interplay among celestial bodies, which is chaotic in nature."
     
    It is sorta covered in the JavaRanch Style Guide.
     
    subject: String recognition questions...
     
    Similar Threads
    And how do I do this?
    Root Finding
    SQL injection?
    Can someone shed some light on this program
    can you help with this?