heinz said:
I have read a String,which called "Input a,b,c;" from a txt file
and now I wonna write it into java Format,chang it into really Input a,b,c;
just like a sentence in java.
How can I do it from the string into the file?
You're question isn't very clear, so I'm going to make a few guesses.
Do you mean that the String initially has quotes, and you want to remove
them? If so, String.substring can do the trick.
If you want to plug in arbitrary code into a Java source file during the
build process, there are a number of utilities to do that. You might
consider m4, which is a very powerful macro processor that can
accomplish tasks like this.
Or do you want to execute that code? In that case, you've got quite a
task in front of you. Java is a compiled language, so you can't
interpret source code at runtime. You *can* call the Java compiler,
assuming that the full J2SDK is installed rather than just the JRE, but
you will need to wrap that code fragment in it's own class. You
certainly can't declare any local variables that would be accessible in
the current method (and if you could, how would you access them since
you don't know their names when you're writing the app?).
--
www.designacourse.com
The Easiest Way to Train Anyone... Anywhere.
Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation