How to resolve the algorithm String matching step by step in the OxygenBasic programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm String matching step by step in the OxygenBasic programming language
Table of Contents
Problem Statement
Given two strings, demonstrate the following three types of string matching:
Optional requirements:
Let's start with the solution:
Step by Step solution about How to resolve the algorithm String matching step by step in the OxygenBasic programming language
Source code in the oxygenbasic programming language
string s="sdfkjhgsdfkdfgkbopefioqwurti487sdfkrglkjfs9wrtgjglsdfkdkjcnmmb.,msfjflkjsdfk"
string f="sdfk"
string cr=chr(13)+chr(10),tab=chr(9)
string pr="FIND STRING LOCATIONS" cr cr
sys a=0, b=1, count=0, ls=len(s), lf=len(f)
do
a=instr b,s,f
if a=0 then exit do
count++
if a=1 then pr+="Begins with keyword" cr
pr+=count tab a cr
if a=ls-lf+1 then pr+="Ends with keyword at " a cr
b=a+1
end do
pr+=cr "Total matches: " count cr
print pr
'FIND STRING LOCATIONS
'
'Begins with keyword
'1 1
'2 8
'3 32
'4 51
'5 73
'Ends with keyword at 73
'
'Total matches: 5
You may also check:How to resolve the algorithm GSTrans string conversion step by step in the Rust programming language
You may also check:How to resolve the algorithm Even or odd step by step in the Wren programming language
You may also check:How to resolve the algorithm Proper divisors step by step in the Dyalect programming language
You may also check:How to resolve the algorithm Call a function step by step in the Mathematica / Wolfram Language programming language
You may also check:How to resolve the algorithm Null object step by step in the ARM Assembly programming language