Letter frequency: Difference between revisions
Content deleted Content added
m →{{header|Phix}}: output ten per line |
|||
Line 1,372: | Line 1,372: | ||
=={{header|AutoHotkey}}== |
=={{header|AutoHotkey}}== |
||
<br>This is the past version of this edit but made into a function, and now it only shows the letters that are in it, but not the ones with 0 letters |
|||
<lang AutoHotkey>OpenFile = %A_ScriptFullPath% ; use own source code |
|||
<lang AutoHotkey>LetterFreq(Var) { |
|||
FileRead, FileText, %OpenFile% |
|||
Loop 26 |
Loop, 26 |
||
{ |
{ |
||
StrReplace(Var, Chr(96+A_Index), , Count) |
|||
if Count |
|||
out .= Chr(96+A_Index) ": " Count "`n" |
|||
} |
|||
return out |
|||
} |
} |
||
MsgBox % out</lang> |
|||
var := "The dog jumped over the lazy fox" |
|||
{{out}} (using script's own file): |
|||
var2 := "foo bar" |
|||
Msgbox, % LetterFreq(var) |
|||
Msgbox, % LetterFreq(var2)</lang> |
|||
{{out}} |
|||
<pre> |
<pre> |
||
a: |
a: 1 |
||
⚫ | |||
⚫ | |||
⚫ | |||
g: 1 |
|||
h: 2 |
|||
j: 1 |
|||
l: 1 |
|||
m: 1 |
|||
o: 3 |
|||
p: 1 |
|||
r: 1 |
|||
t: 2 |
|||
u: 1 |
|||
v: 1 |
|||
x: 1 |
|||
y: 1 |
|||
z: 1 |
|||
--------------------------- |
|||
--------------------------- |
|||
a: 1 |
|||
b: 1 |
b: 1 |
||
f: 1 |
|||
o: 2 |
|||
⚫ | |||
⚫ | |||
[several lines omitted] |
|||
⚫ | |||
⚫ | |||
⚫ | |||
=={{header|AutoIt}}== |
=={{header|AutoIt}}== |