Converting roman to arabic number and vice versa


#1

If someone has the need to convert roman numbers to arabic numbers or vice versa here are two action groups that can help to do so.

The action group 'Num Roman to Arab' takes as input a valid roman number string and returns an arabic number.
The input value is expected to be stored in a tag named 'NUM_ROMAN'.
At end of run the input tag 'NUM_ROMAN' will be removed from the tag list.
The result is given in the tag named 'NUM_ARAB'.

The action group 'Num Arab to Roman' takes as input an arabic number and returns a roman number string.
The input value is expected to be stored in a tag named 'NUM_ARAB'.
At end of run the input tag 'NUM_ARAB' will be removed from the tag list.
The result is given in the tag named 'NUM_ROMAN'.

Allowed roman symbolic numbers:
H = 100000
Y =  50000
T =  10000
F =   5000
M =   1000
D =    500
C =    100
L =     50
X =     10
V =      5
I =      1

Allowed arabic numbers:
1 .. 99999

The algorithm development relies on scripting code of Mp3tag version 2.37f.
It respects that there are some bugs in some Mp3tag scripting functions which have been detected recently in Mp3tag version 2.37f.
Nevertheless, by implementing appropriate workaround, I got the action groups working fine.
If those Mp3tag scripting bugs will be removed, then the code of the action groups can be further optimized.

Num_Roman_to_Arab.mta (9.16 KB)
Num_Arab_to_Roman.mta (1.33 KB)

DD.20070304.1230

Num_Arab_to_Roman.mta (1.33 KB)

Num_Roman_to_Arab.mta (9.16 KB)


Please help with another special regular expression
Help with roman numerals?