Abbreviations, automatic: Difference between revisions
Content added Content deleted
Line 1,642: | Line 1,642: | ||
2 > Eh Se Ma Er Ha Ar Ke |
2 > Eh Se Ma Er Ha Ar Ke |
||
5 > Al_Ah Al_It Al_Th Al_Ar Al_Ka Al_Go Al_Sa </pre> |
5 > Al_Ah Al_It Al_Th Al_Ar Al_Ka Al_Go Al_Sa </pre> |
||
'''Another solution could be:''' |
|||
<syntaxhighlight lang="autohotkey"> |
|||
Loop, Read, days-of-the-week.txt ; input text in current dir |
|||
{ |
|||
if (A_Index > 10) ; number of lines to output |
|||
break |
|||
Loop, Parse, A_LoopReadLine, %A_Space% ; create an array of the days |
|||
word%A_Index% := A_LoopField ; word1=sunday, word2=monday ... |
|||
loop |
|||
{ |
|||
x := A_Index ;save the last loop index |
|||
abrev := "" |
|||
loop 7 |
|||
abrev .= SubStr(word%A_Index%, 1, x) . "," ; x = length to test (1,2,3...) |
|||
sort, abrev, U D, ; sort unique (errorlevel = duplicates) |
|||
} |
|||
until ErrorLevel = 0 ;stay with last loop index (length) |
|||
minimalAb .= x . " " . A_LoopReadLine . " (" . abrev . ")`n" |
|||
} |
|||
msgbox % minimalAb |
|||
ExitApp |
|||
</syntaxhighlight> |
|||
{{Out}} |
|||
<pre> |
|||
Abbreviations Automatic.ahk |
|||
--------------------------- |
|||
2 Sunday Monday Tuesday Wednesday Thursday Friday Saturday (Fr,Mo,Sa,Su,Th,Tu,We,) |
|||
2 Sondag Maandag Dinsdag Woensdag Donderdag Vrydag Saterdag (Di,Do,Ma,Sa,So,Vr,Wo,) |
|||
4 E_djelë E_hënë E_martë E_mërkurë E_enjte E_premte E_shtunë (E_dj,E_en,E_hÃ,E_ma,E_mÃ,E_pr,E_sh,) |
|||
2 Ehud Segno Maksegno Erob Hamus Arbe Kedame (Ar,Eh,Er,Ha,Ke,Ma,Se,) |
|||
5 Al_Ahad Al_Ithinin Al_Tholatha'a Al_Arbia'a Al_Kamis Al_Gomia'a Al_Sabit (Al_Ah,Al_Ar,Al_Go,Al_It,Al_Ka,Al_Sa,Al_Th,) |
|||
4 Guiragui Yergou_shapti Yerek_shapti Tchorek_shapti Hink_shapti Ourpat Shapat (Guir,Hink,Ourp,Shap,Tcho,Yere,Yerg,) |
|||
2 domingu llunes martes miércoles xueves vienres sábadu (do,ll,ma,mi,sÃ,vi,xu,) |
|||
2 Bazar_gÃœnÃœ Birinci_gÃœn Çkinci_gÃœn ÜçÜncÃœ_gÃœn DÖrdÃœncÃœ_gÃœn Bes,inci_gÃœn Altòncò_gÃœn (Al,Ba,Be,Bi,DÃ,Ãœ,Ç,) |
|||
6 Igande Astelehen Astearte Asteazken Ostegun Ostiral Larunbat (Astear,Asteaz,Astele,Igande,Larunb,Ostegu,Ostira,) |
|||
4 Robi_bar Shom_bar Mongal_bar Budhh_bar BRihashpati_bar Shukro_bar Shoni_bar (BRih,Budh,Mong,Robi,Shom,Shon,Shuk,) |
|||
--------------------------- |
|||
OK |
|||
</pre> |
|||
=={{header|AWK}}== |
=={{header|AWK}}== |