GIL wrote:Code: Select all
RegSub(RegSub(RegSub(RegSub(RegSub(oSongData.Path,"\bI\b","1"),"\bII\b","2"),"\bIII\b","3"),"\bIV\b","4"),"\bV\b","5")
Is there a more efficient way to do this?
I may be using more substitutions
Well, you could not simplify it too much. You could try with the MapArray function as it is in the "Fix common words (I'm, I'll, don't, won't, ain't, isn't, can't)" preset. For your example:
Find what:
Replace with:
Code: Select all
MapArray(Array("$1", "1", "$2", "2", "$3", "3", "$4", "4", "$5", "5"))
However, there is a bug in the MapChr function, so you need to modify the source code of the script if you want to write numbers as a replacement. In the line 987 instead of:
you should write:
The next version of the script would have somewhat simpler MapArrayEx function with which you could write the
Replace with string directly, without specifying strings for replacement in the
Find what field as it is in previous case. Here is its future use:
Code: Select all
MapArrayEx("$&", Array("\bI\b", "1", "\bII\b", "2", "\bIII\b", "3", "\bIV\b", "4", "\bV\b", "5"))
If you are interested for such syntax, I could publish the updated script with that function. By the way, you will have a problem with English word "I" with those replacements.