I want to detect if a string is a valid javasript code for pass it for the evaluation of rhino engine, now i'm assuming that the string is a javascript script with this simple statement :
if(jsString.trim().endsWith(";")) {
//Evaluate with Rhino
}
Is there a better way for figure out if a string is a valid JS script ?
What is the best way ?