occursin() / replace()
Searching and replacing.
Syntax
occursin("x", s) // replace(s, "a"=>"b")Description
occursin tells whether a substring exists in the text (true/false). replace swaps matches using the arrow (=>).
Example
Loading editor…
Expected output
true 2024/01
When to use?
Search boxes, text sanitization.