Autogram checker: Difference between revisions
m
fix letter count to skip spaces
(→{{header|J}}: marked incorrect) |
m (fix letter count to skip spaces) |
||
Line 135:
charcounts = counter(s)
stillneedmention = Dict(p[1] => isletter(p[1]) || p[1] != ' ' && countpunctuation ? p[2] : 0 for p in charcounts)
len =
s = " " * replace(s, r"^\.(?:employs|composed|contains)" => "")
for mention in split(s, r"\s*,|:\s*")
Line 143:
numfromtext == 0 && continue
c = mention[begin+spos:end]
if c == "letters"
return false
end
continue
end
ch = contains(c, "comma") ? ',' : contains(c, "apostrophe") ? '\'' : contains(c, "hyphen") ? '-' : Char(c[1])
Line 187 ⟶ 190:
Test phrase 4 is a valid autogram.
▲The total letter count (should be 291) is incorrect.
▲Test phrase 5 is not a valid autogram.
Test phrase 6 is a valid autogram.
|