How to check whether Unicode code is within a string in Go

1 Answer

0 votes
package main

import (
	"fmt"
	"strings"
)

func main() {
	// func ContainsRune(s string, r rune) bool

	// 'a' code is 97

	fmt.Println(strings.ContainsRune("golang", 97))
	fmt.Println(strings.ContainsRune("python", 97))
}


/*
run:

true
false

*/

 



answered Aug 22, 2024 by avibootz
...