Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,33 @@
|
|||
Filter FromRoman {
|
||||
$output = 0
|
||||
|
||||
if ($_ -notmatch '^(M{1,3}|)(CM|CD|D?C{0,3}|)(XC|XL|L?X{0,3}|)(IX|IV|V?I{0,3}|)$') {
|
||||
throw 'Incorrect format'
|
||||
}
|
||||
|
||||
$current = 1000
|
||||
$subtractor = 'M'
|
||||
$whole = $False
|
||||
$roman = $_
|
||||
'C','D','X','L','I','V',' ' `
|
||||
| %{
|
||||
if ($whole = !$whole) {
|
||||
$current /= 10
|
||||
$subtractor = $_ + $subtractor[0]
|
||||
$_ = $subtractor[1]
|
||||
}
|
||||
else {
|
||||
$subtractor = $subtractor[0] + $_
|
||||
}
|
||||
|
||||
if ($roman -match $subtractor) {
|
||||
$output += $current * (4,9)[$whole]
|
||||
$roman = $roman -replace $subtractor,''
|
||||
}
|
||||
if ($roman -match ($_ + '{1,3}')) {
|
||||
$output += $current * (5,10)[$whole] * $Matches[0].Length
|
||||
}
|
||||
}
|
||||
|
||||
$output
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
'XIX','IV','','MMCDLXXIX','MMMI' | FromRoman
|
||||
Loading…
Add table
Add a link
Reference in a new issue