Answers for "golang substring"

Go
4

golang string split

s := strings.Split("a,b,c", ",")
Posted by: Guest on August-20-2020
1

golang substring

s = s[:len(s)-1]
Posted by: Guest on December-11-2020
1

golang find in string

// 1. Contains
res := strings.Contains(str, substr)
fmt.Println(res) // true
Posted by: Guest on August-20-2020
0

subdevide string golang

package main

import (
	"fmt"
	"strings"
)

func main() {
	fmt.Printf("%q\n", strings.Split("a,b,c", ","))
	fmt.Printf("%q\n", strings.Split("a man a plan a canal panama", "a "))
	fmt.Printf("%q\n", strings.Split(" xyz ", ""))
	fmt.Printf("%q\n", strings.Split("", "Bernardo O'Higgins"))
}
Posted by: Guest on February-04-2021

Browse Popular Code Answers by Language