Extracting substrings in Go

后端 未结 7 820
甜味超标
甜味超标 2020-12-12 21:12

I\'m trying to read an entire line from the console (including whitespace), then process it. Using bufio.ReadString, the newline character is read together with the input, s

7条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-12 21:58

    To get substring

    1. find position of "sp"

    2. cut string with array-logical

    https://play.golang.org/p/0Redd_qiZM

提交回复
热议问题