- 
				
				
眼眸繁星
				在所有编程语言中有很多方法可以拆分字符串。由于我不知道您特别要求什么,因此我提供了一种示例方法来从您的示例中获取您想要的输出。package mainimport "strings"import "fmt"func main() {    initial := "<h1>Hello World!</h1>"    out := strings.TrimLeft(strings.TrimRight(initial,"</h1>"),"<h1>")    fmt.Println(out)}在上面的代码中,您<h1>从字符串的左侧和</h1>右侧修剪。正如我所说,拆分特定字符串的方法有数百种,这只是帮助您入门的示例。希望它有所帮助,Golang 祝你好运:)D B
				
			 
			
			- 
				
				
一只萌萌小番薯
				如果字符串看起来像什么;START;extract;END;whatever 你可以使用它来获得介于两者之间的字符串:// GetStringInBetween Returns empty string if no start string foundfunc GetStringInBetween(str string, start string, end string) (result string) {    s := strings.Index(str, start)    if s == -1 {        return    }    s += len(start)    e := strings.Index(str[s:], end)    if e == -1 {        return    }    e += s + e - 1    return str[s:e]}这里发生的是它将找到 START 的第一个索引,添加 START 字符串的长度并返回从那里到 END 的第一个索引为止存在的所有内容。
				
			 
			
			- 
				
				
江户川乱折腾
				我改进了Jan Kardaš答案。现在您可以在开头和结尾找到超过 1 个字符的字符串。func GetStringInBetweenTwoString(str string, startS string, endS string) (result string,found bool) {    s := strings.Index(str, startS)    if s == -1 {        return result,false    }    newS := str[s+len(startS):]    e := strings.Index(newS, endS)    if e == -1 {        return result,false    }    result = newS[:e]    return result,true}