Autogram checker: Difference between revisions
m
→{{header|Julia}}: typos
m (→{{header|J}}) |
m (→{{header|Julia}}: typos) |
||
Line 131:
Verify an autogram. Count punctuation if second argument is true, error messages if verbose
"""
function isautogram(txt, countpunctuation
s = lowercase(txt)
charcounts = counter(s)
stillneedmention = Dict(p[1] => isletter(p[1]) || p[1] != ' ' && countpunctuation ? p[2] : 0 for p in charcounts)
len = length(s)
s = " " * replace(s,
for mention in split(s, r"\s*,|:\s*")
mention = replace(mention, r" and$" => "")
|