Roman Numerals Conversion
Mark Schonewille
m.schonewille at economy-x-talk.com
Thu Mar 25 13:35:35 EDT 2010
Francis,
function romanToArab theNumber
put "i,v,x,l,c,d,m" into myRomans
put "1,5,10,50,100,1000,10000" into myArabs
put item itemoffset(last char of theNumber,myRomans) of myArabs
into myNumber
repeat with x = (number of chars of theNumber - 1) down to 1
put item itemoffset(char x of theNumber,myRomans) of
myArabs into myTemp1
put item itemoffset(char x + 1 of theNumber,myRomans) of
myArabs into myTemp2
if myTemp1 < myTemp2 then
subtract myTemp1 from myNumber
else add myTemp1 to myNumber
end repeat
return myNumber
end romanToArab
Is this done in Revfor the first time? I hope you don't mind ;-)
--
Best regards,
Mark Schonewille
Economy-x-Talk Consulting and Software Engineering
Homepage: http://economy-x-talk.com
Twitter: http://twitter.com/xtalkprogrammer
Economy-x-Talk is always looking for new software development
projects. Feel free to contact me for a quote.
Op 25 mrt 2010, om 18:10 heeft Francis Nugent Dixon het volgende
geschreven:
> Hi from Beautiful Brittany,
>
> I've searched around, and have found many
> scripts in many languages for converting
> Roman Numerals into Numbers, but couldn't
> find one that I can use in a Rev Stack.
>
> Has anybody come across a script that I
> don't know about ?
>
> With Thanks
>
> -Francis
>
> "Nothing should ever be done for the first time !"
>
More information about the use-livecode
mailing list