Concept Flow - Substring Search Patterns
Start
Set index i=0 in text
Compare substring with text at i
Match?
|Yes
Return i (match found)
End
No
Increment i
i <= text.length - substring.length?
|Yes
Return -1 (no match)
End
↩Back to Compare
The search moves through the text, checking if the substring matches at each position until a match is found or the text ends.
