String matching: Difference between revisions

Added Odin variant
No edit summary
(Added Odin variant)
Line 3,406:
that other cloud looks like a llama" "cloud" ;;
- : bool * int = (true, 2)
 
=={{header|Odin}}==
 
<syntaxhighlight lang="odin">package main
 
import "core:fmt"
import "core:strings"
 
main :: proc() {
using strings
 
s := "Hello world"
 
fmt.println(has_prefix(s, "He"), contains(s, "wo"), has_suffix(s, "ld"))
// Output: true true true
 
fmt.println(index(s, "wo"))
// Output: 6
}</syntaxhighlight>
 
=={{header|Oforth}}==
29

edits