Abbreviations, automatic: Difference between revisions
Content added Content deleted
Walterpachl (talk | contribs) (→{{header|REXX}}: ooRexx conformane, readability, duplicate wprd in list) |
(Added FreeBASIC) |
||
Line 3,203: | Line 3,203: | ||
2 Killachau Atichau Quoyllurchau Illapachau Chaskachau Kuychichau Intichau |
2 Killachau Atichau Quoyllurchau Illapachau Chaskachau Kuychichau Intichau |
||
</pre> |
</pre> |
||
=={{header|FreeBASIC}}== |
|||
{{trans|Yabasic}} |
|||
<syntaxhighlight lang="vbnet">Function Tokenize(text As String, tokens() As String) As Integer |
|||
Dim As Integer count = 0, posic = 1, start |
|||
While posic <= Len(text) |
|||
If Mid(text, posic, 1) <> " " Then |
|||
start = posic |
|||
While posic <= Len(text) Andalso Mid(text, posic, 1) <> " " |
|||
posic += 1 |
|||
Wend |
|||
count += 1 |
|||
tokens(count) = Mid(text, start, posic - start) |
|||
End If |
|||
posic += 1 |
|||
Wend |
|||
Return count |
|||
End Function |
|||
Function Buscar(s As String) As Integer |
|||
Dim As Integer n, d, i, j |
|||
Dim As Boolean s_flag |
|||
Dim As String a, b |
|||
Dim As String r(1 To 100) ' Assuming a maximum of 100 tokens |
|||
n = Tokenize(s, r()) |
|||
d = 1 |
|||
Do |
|||
s_flag = True |
|||
For i = 1 To n |
|||
For j = i + 1 To n |
|||
a = Left(r(i), d) |
|||
b = Left(r(j), d) |
|||
If a = "" Or b = "" Then |
|||
s_flag = True |
|||
Exit For |
|||
Elseif a = b Then |
|||
s_flag = False |
|||
d += 1 |
|||
Exit For |
|||
End If |
|||
Next j |
|||
If Not s_flag Then Exit For |
|||
Next i |
|||
Loop Until s_flag |
|||
Return d |
|||
End Function |
|||
Dim As Integer fileNum = Freefile() |
|||
If Open("days_of_week.txt" For Input As #fileNum) = 0 Then |
|||
Dim As String s |
|||
While Not Eof(fileNum) |
|||
Line Input #fileNum, s |
|||
Print Buscar(s); " "; s |
|||
Wend |
|||
Close #fileNum |
|||
Else |
|||
Print "Error opening file." |
|||
End If |
|||
Sleep</syntaxhighlight> |
|||
=={{header|FutureBasic}}== |
=={{header|FutureBasic}}== |