Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
18
Task/String-matching/QB64/string-matching.qb64
Normal file
18
Task/String-matching/QB64/string-matching.qb64
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
DefStr S
|
||||
DefInt P
|
||||
string2 = "dogs"
|
||||
string1 = "dogs and cats are often enemies,because dogs are stronger than cats, but cats sometimes can be friend to dogs"
|
||||
position = 0
|
||||
pcount = 0
|
||||
Print "Searching "; string2; " into "; string1
|
||||
While (InStr(position, string1, string2) > 0)
|
||||
position = InStr(position + 1, string1, string2)
|
||||
pcount = pcount + 1
|
||||
If position = 1 Then Print string1; "- starts with -"; string2
|
||||
Print position
|
||||
If position = Len(string1) - Len(string2) + 1 Then
|
||||
Print string1; "- ends with -"; string2
|
||||
Exit While
|
||||
End If
|
||||
Wend
|
||||
Print string2; " is present "; pcount; " times into "; string1
|
||||
Loading…
Add table
Add a link
Reference in a new issue