Text processing/2: Difference between revisions
Content added Content deleted
No edit summary |
No edit summary |
||
Line 1,694: | Line 1,694: | ||
Bad format: |
Bad format: |
||
</pre> |
|||
=={{header|M2000 Interpreter}}== |
|||
<lang M2000 Interpreter> |
|||
Module TestThis { |
|||
Document a$, exp$ |
|||
\\ automatic find the enconding and the line break |
|||
Load.doc a$, "readings.txt" |
|||
m=0 |
|||
n=doc.par(a$) |
|||
k=list |
|||
nl$={ |
|||
} |
|||
l=0 |
|||
exp$=format$("Records: {0}", n)+nl$ |
|||
For i=1 to n |
|||
b$=paragraph$(a$, i) |
|||
If exist(k,Left$(b$, 10)) then |
|||
m++ : where=eval(k) |
|||
exp$=format$("Duplicate for {0} at {1}",i, where)+nl$ |
|||
Else |
|||
Append k, Left$(b$, 10):=i |
|||
End if |
|||
Stack New { |
|||
Stack Mid$(Replace$(chr$(9)," ", b$), 11) |
|||
while not empty { |
|||
Read a, b |
|||
if b<=0 then l++ : exit |
|||
} |
|||
} |
|||
Next |
|||
exp$= format$("Duplicates {0}",m)+nl$ |
|||
exp$= format$("Valid Records {0}",n-l)+nl$ |
|||
clipboard exp$ |
|||
report exp$ |
|||
} |
|||
TestThis |
|||
</lang> |
|||
{{out}} |
|||
<pre> |
|||
Records: 5471 |
|||
Duplicate for 85 at 84 |
|||
Duplicate for 456 at 455 |
|||
Duplicate for 820 at 819 |
|||
Duplicate for 1184 at 1183 |
|||
Duplicate for 1911 at 1910 |
|||
Duplicates 5 |
|||
Valid Records 5017 |
|||
</pre> |
</pre> |
||
=={{header|Mathematica}}== |
=={{header|Mathematica}}== |