String matching: Difference between revisions

no edit summary
No edit summary
Line 1,352:
First string contains second string : at index 1 and at index 8
First string ends with second string : true
</pre>
 
=={{header|Gambas}}==
<lang gambas>Public Sub Main()
Dim sString1 As String = "Hello world"
Dim sString2 As String = "Hello"
 
Print sString1 Begins Left(sString2, 5) 'Determine if the first string starts with second string
If InStr(sString1, sString2) Then Print "True" Else Print "False" 'Determine if the first string contains the second string at any location
Print sString1 Ends Left(sString2, 5) 'Determine if the first string ends with the second string
 
End</lang>
Output:
<pre>
True
True
False
</pre>
 
Anonymous user