Im my Java application, users can specify how to name their files from a series of metadata fields. i.e
%artist% - %album% - %disctotal%
My code then parses these fields and renames file accoringly. But I want the user to be able to use an 'expression languge' so they can say things like:
$if(%disctotal% >= 01,%discno%)
Use ifelse
, compare length and case and so on.
I dont want to write this from scratch, is there something that offers me this that I can just plugin to my code?
EDIT:I think Ive had some good replies, but my knowledge is letting me down. Lets simplify the issue I want the user to be able to write
$if(%disctotal% >= 01,%discno%)
into a field in a gui.
Then later on in my Java code I want to be able to apply this expression to a set of files, so for each file I have the value of disctotal, and discno but I want to be able to convert the expression into something like
if(discTotal >=1) { return discNo } else { return "" }
What I dont want to do is have to write the code that recognises the string (" $if(%disctotal% >= 01,%discno%)" is an if statement because this is akward to do.
Then expanding on this I would like the expression to allow things such as capitalizing oof fields, checking lengths of fields and so on.
Alternatively: Perhaps it should work this way, the user enters the expression, then at a later date for each file the Java code replaces each variable with the real value
i.e $if(%disctotal% >= 01,%discno%) -> $if(2 >= 01,1)
then this is passed to the exopression language to parse and give a result,
Is this the Javascript idea ?