Golang | Splitting the string after the specified separator
In Go language, strings are different from other languages like Java, C++, Python, etc. It is a sequence of variable-width characters where each and every character is represented by one or more bytes using UTF-8 Encoding.
In the Go strings, you are allowed to split the string after the specified separator using a SplitN() function. This function splits a slice into all substrings after each instance of the given separator and returns a slice of the substrings between those separators. The count indicates the number of subslices to return. It is defined under the string package so, you have to import string package in your program for accessing SplitN function.
func SplitN(str, sep string, m int) string
Here, str is the string and sep is the separator. If str does not contain the given sep and sep is non-empty, then it will return a slice of length 1 which contain only str. Or if the sep is empty, then it will split after each UTF-8 sequence. Or if both str and sep are empty, then it will return an empty slice.
Final Result after splitting: Slice 1: [****Welcome to GeeksforGeeks****] Slice 2: [Learning how to x trim x a x slice of bytes] Slice 3:  Slice 4: 
Original Strings: String 1: Welcome, to, Geeks, for, Geeks String 2: AppleAppleAppleAppleAppleApple String 3: %G%E%E%K%sS After splitting: String 1: [Welcome to, Geeks, for, Geeks] String 2: [A leA leAppleAppleAppleApple] String 3: