File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes how to convert a String into an expression Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "how to convert a String into an expression" Watch "how to convert a String into an expression" New topic
Author

how to convert a String into an expression

Oni Anand
Ranch Hand

Joined: Jan 26, 2001
Posts: 41
Hi,
i have a following string :
"if ( ((X < 20 ) && ( Y > 50)) | | ( Z ==56) ) "
i want to convert it to a java condtional expression...how can i do that ??
as a matter of fact i want to know is there any generic way to convert any string to a corresponding java expression or statement or variable declaration.
thanks
Oni
Manfred Leonhardt
Ranch Hand

Joined: Jan 09, 2001
Posts: 1492
Hi,
You can do it through hard work and recursive procedures ...
There is no generic way to convert any string to a corresponding java expression or statement, but there is a specific way. Sun defined a way to do it. They even went so far as designing it and giving it away to the public. They even supplied a specification guide and everything!
Manfred.
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
I am a bit confused (as usual). Are you looking to take in this string when you execute your code? If so you would already be past the compile point and who cares if it is a java conditional expression or not.
I think that I need straightening out.....


"JavaRanch, where the deer and the Certified play" - David O'Meara
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: how to convert a String into an expression
 
Similar Threads
SQL statement to java
Evaluating string expressions
how to convert a String into an expression
how to convert a string to a java expression ??
how to convert a String into an expression