Thank you, Marvin. About the same time you wrote this, the answer likewise
dawned on me.
> Look at https://play.golang.org/p/2tz2asuZcGc where I have changed
>
> fmt.Println(tmp)
> to
> fmt.Printf("%#v\n", tmp)
>
> and I think you will understand that tmp does not contain what yo
On Tuesday, February 20, 2018 at 2:00:32 PM UTC-7, Jan Mercl wrote:
>
>
> I don't know how the concept of word got involved in the "expected"
> behavior, but the code shown has nothing to do with something like "word".
> It works purely with strings and slices of strings and is AFAICT working a
* buc...@gmail.com [180220 15:51]:
> package main
>
> import (
> "fmt"
> "strings"
> )
>
> func main() {
> s := "this/that there/here that/this"
> tmp := strings.Split(s, "/")
> fmt.Println(tmp)
> for _, s1 := range tmp {
> if strings.Contains(s1, "that") {
> fmt.Println(s1
On Tue, Feb 20, 2018 at 9:51 PM wrote:
> But instead the second fmt.Println() output implies that it grabbed more
than one word.
>
> I'm a noob and puzzled by this behavior.
I don't know how the concept of word got involved in the "expected"
behavior, but the code shown has nothing to do with so
package main
import (
"fmt"
"strings"
)
func main() }
s := "this/that there/here that/this"
tmp := strings.Split(s, "/")
fmt.Println(tmp)
for _, s1 := range tmp {
if strings.Contains(s1, "that") {
fmt.Println(s1)
}
}
}
Output:
this was as expected:
[this that there here that this]