include? / index
Is a substring present / where is it?
Syntax
text.include?(part)
Description
include? returns true/false, index returns the position (or nil if missing). Methods ending with ? return true/false.
Example
Loading editor…
Expected output
true 3
When to use?
Search, content check.