String matching: Difference between revisions

Added FreeBASIC
(Lingo added)
(Added FreeBASIC)
Line 1,269:
</pre>
In recent standards of Fortran strings as intrinsic first-class type and many intrinsic procedures for strings manipulation have been added.
 
=={{header|FreeBASIC}}==
<lang freebasic>' FB 1.05.0 Win64
 
Dim As String s1 = "abracadabra"
Dim As String s2 = "abra"
Print "First string : "; s1
Print "Second string : "; s2
Print
Print "First string begins with second string : "; CBool(s2 = Left(s1, Len(s2)))
Dim As Integer i1 = Instr(s1, s2)
Dim As Integer i2
Print "First string contains second string : ";
If i1 Then
Print "at index"; i1;
i2 = Instr(i1 + Len(s2), s1, s2)
If i2 Then
Print " and at index"; i2
Else
Print
End If
Else
Print "false";
End If
Print "First string ends with second string : "; CBool(s2 = Right(s1, Len(s2)))
Print
Print "Press any key to quit"
Sleep</lang>
 
{{out}}
<pre>
First string : abracadabra
Second string : abra
 
First string begins with second string : true
First string contains second string : at index 1 and at index 8
First string ends with second string : true
</pre>
 
=={{header|GML}}==
9,485

edits