I before E except after C: Difference between revisions

Added another uBasic/4tH version
(Added another uBasic/4tH version)
Line 4,447:
</pre>
 
=={{header|uBasic/4tH}}==
{{trans|Power shell}}
<lang>If Set(a, Open ("unixdict.txt", "r")) < 0 Then Print "Cannot open \qunixdict.txt\q" : End
 
x = Set (y, Set (p, Set (q, 0)))
 
Do While Read (a)
w = Tok(0)
If FUNC(_Search(w, Dup("cei"))) > -1 Then x = x + 1
If FUNC(_Search(w, Dup("cie"))) > -1 Then y = y + 1
If FUNC(_Search(w, Dup("ie"))) > -1 Then p = p + 1
If FUNC(_Search(w, Dup("ei"))) > -1 Then q = q + 1
Loop
 
Print "The plausibility of 'I before E when not preceded by C' is ";
Print Show (Iif (p>(q+q), "True", "False"))
 
Print "The plausibility of 'E before I when preceded by C' is ";
Print Show (Iif (x>(y+y), "True", "False"))
 
Print "The plausibility of the phrase 'I before E except after C' is ";
Print Show (Iif ((x>(y+y))*(p>(q+q)), "True", "False"))
 
Close a
End
 
_Search
Param (2)
Local (1)
For c@ = 0 to Len (a@) - Len (b@)
If Comp(Clip(Chop(a@,c@),Len(a@)-c@-Len(b@)),b@)=0 Then Unloop : Return (c@)
Next
Return (-1)</lang>
{{Out}}
<pre>The plausibility of 'I before E when not preceded by C' is True
The plausibility of 'E before I when preceded by C' is False
The plausibility of the phrase 'I before E except after C' is False
 
0 OK, 0:800 </pre>
=={{header|UNIX Shell}}==
<lang bash>#!/bin/sh
374

edits