Parsing a field...
Posted: Fri Aug 09, 2013 4:03 pm
In 'Configuring Directory and Filename Formats' there is no listing for any type of function that will help me to parse out part of a field.
For example, if in my <Artist> field for classical music I have the name: "Copland, Aaron"
what I want to do is to extract the name "Copland" by itself. I can achieve pulling out the name if I use the $Left function hard coded with a number like this: $Left(<Artist>,7) which, of course will give me the desired "Copland."
But to code it flexibly for all instances I need to replace the number (in this case '7') with a formula to parse all characters left of the comma delimiter.
In normal VB script syntax I could use a combination of functions like this:
$Left(<Artist>, $InStr(<Artist>, ",")-1)
which would calculate the position of the comma delimiter (in this case position
then subtract one character to leave 7 and then use that number 7 as the argument for the $Left() function -- resulting in the desired return of 'Copland.'
Similarly, if the <Artist> field read "Igor Stravinsky" I can find no way to automatically select the last name (i.e. everything right of the space) either.
Any suggestions on what method I could employ instead of this..?
Or, if not, I would think that adding such functionality to the code base for MediaMonkey would be very desirable.
For example, if in my <Artist> field for classical music I have the name: "Copland, Aaron"
what I want to do is to extract the name "Copland" by itself. I can achieve pulling out the name if I use the $Left function hard coded with a number like this: $Left(<Artist>,7) which, of course will give me the desired "Copland."
But to code it flexibly for all instances I need to replace the number (in this case '7') with a formula to parse all characters left of the comma delimiter.
In normal VB script syntax I could use a combination of functions like this:
$Left(<Artist>, $InStr(<Artist>, ",")-1)
which would calculate the position of the comma delimiter (in this case position
Similarly, if the <Artist> field read "Igor Stravinsky" I can find no way to automatically select the last name (i.e. everything right of the space) either.
Any suggestions on what method I could employ instead of this..?
Or, if not, I would think that adding such functionality to the code base for MediaMonkey would be very desirable.