比方说我现在有个字符串是
<a class="pturl" href="/24711161/plain/">Download as text</a>
很显然,这是个html中的元素
我可以这样切出来:
index1 := strings.Index(str_body, "pturl")
index2 := strings.Index(str_body, "Download as text")
str := str_body[index1:index2]
fmt.Println(str)//pturl" href="/24711161/plain/">
但是我想切出/24711161/plain/
,于是尝试这么写:
index1 := strings.Index(str_body, "pturl" href="")
index2 := strings.Index(str_body, "Download as text")
str := str_body[index1:index2]
fmt.Println(str)//pturl" href="/24711161/plain/">
但是会报错: syntax error: unexpected href, expecting comma or )
请问我该怎么做?
对Go不熟,感觉有点傻,求各位大神不喷哈: