I am trying to split string based on split function in golang. But getting illegal rune literal error for r == ‘/–/’ && r == ‘/-iN-/’ && r == ‘/–/’
func Split(r rune) bool {
return r == '/--/' && r == '/-iN-/' && r == '/--/'
}
>Solution :
In Go, you can use single quotes for literal values that consist of a single character.
If you want to write a string literal, you should use double quotes or backticks :
'/' // <- a single character
"/--/" // <- a string
`/--/` // <- also a string
You would also have to change your Split function because a rune cannot be compared to a string.