Use a back quote instead of an apostrophe, example:
idPost = strings.Split(idPost,`"`)
Answer from Timofey Belanenko on Stack OverflowGo Packages
pkg.go.dev › strings
strings package - strings - Go Packages
FieldsFunc splits the string s at each run of Unicode code points c satisfying f(c) and returns an array of slices of s. If all code points in s satisfy f(c) or the string is empty, an empty slice is returned. Every element of the returned slice is non-empty.
Videos
What's New in Golang 1.24: SplitSequence
18:43
String manipulations - Go programming language tutorial (19) - YouTube
07:44
The strings Package in Go - YouTube
02:09
Golang | convert the string to array using Split function in Go ...
Golang standard library - String Package part 05
07:04
String Basics in Go - YouTube
Top answer 1 of 2
17
Use a back quote instead of an apostrophe, example:
idPost = strings.Split(idPost,`"`)
2 of 2
1
you need to escape it, so your question is how to escape characters in go.
Escapes and multiline strings
You will find this is similar across many languages:
dPost = strings.Split(idPost,"\"")
Educative
educative.io › answers › how-to-split-a-string-in-golang
How to split a string in Golang
The Split() method in Golang (defined in the strings library) breaks a string down into a list of substrings using a specified separator.
Scaler
scaler.com › home › topics › golang › golang string split function
GoLang String Split Function - Scaler Topics
December 16, 2022 - The functions are defined in the string package and hence need to be imported before using the function. The method split() in the Golang Split String is defined as a string library that breaks the string into a list of substrings by using a specified separator.
Reddit
reddit.com › r/golang › string splitting
r/golang on Reddit: String Splitting
December 30, 2019 -
I am trying to split a string in the easiest way possible. I have three variables of data to get from a split string. I already have the first one answered.
c := "bf19a/dba14@org:dye" ss := strings.Split(login, "/")[0] // Get Everything before the first / ss2 := strings.Split(strings.Split(login, "/")[1], "@")[0]//Get everything between the first / and @ ss3 := strings.Split(login, "@")[1] // Get Everything after the @
My issue is now, if the string looks like this but I still need the 3 variables of data
c := "bf19a/dba14.jake/helo@ess.com@org:dye" // Get Everything before the first / // Get Everything between the first / and the second @ // Get Everything after the second @
Top answer 1 of 4
5
An alternative to regular expressions might be to use strings.Index to find the first '/' and strings.LastIndex to find the last '@'. https://play.golang.org/p/iqy9a7lbl_R
2 of 4
3
"There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is ..."
CodeSignal
codesignal.com › learn › courses › go-string-manipulation-for-beginners › lessons › splitting-and-joining-strings-in-go
Splitting and Joining Strings in Go
In Go, the strings.Split function cuts a string into several pieces based on a delimiter, which is a character that separates words. It returns a slice containing these divided parts.
Golang Docs
golangdocs.com › home › 5 different ways to split string in golang
5 Different Ways to Split String in Golang - Golang Docs
January 28, 2020 - The strings package contains a function called split(), which can be used to split string efficiently.
gosamples
gosamples.dev › tutorials › basics › 8 ways to split a string in go with examples
8 ways to split a string in Go with examples · GOSAMPLES
December 22, 2025 - To split a string in Go into output substrings containing a separator and getting at most n substrings, use the strings.SplitAfterN() function. It splits a string after each occurrence of the delimiter, and the last substring will be the unsplit remainder. The function signature: func ...
Codecademy
codecademy.com › docs › go › strings › fields()
Go | Strings | Fields() | Codecademy
July 11, 2023 - The Fields() function in Go is used to split a string into substrings based on whitespace and return a slice of the substrings. It removes any leading or trailing whitespace and treats consecutive whitespace characters as a single separator.
GeeksforGeeks
geeksforgeeks.org › go language › strings-splitn-function-in-golang-with-examples
strings.SplitN() Function in Golang with Examples - GeeksforGeeks
April 28, 2025 - strings.SplitN() Function() is a string manipulation function in Go language. It is used to split a given string into substrings separated by a separator.
TutorialsPoint
tutorialspoint.com › strings-split-function-in-golang
Go - Split String
March 10, 2022 - It demonstrates splitting 'p' by the characters 'n' and 's', 'q' by the substring "Lang", and 'p' by each individual character. package main import ( "fmt" "strings" "regexp" ) func main() { // Intializing the Strings p := "oopsfunctions" q := "GoLang language" // Display the Strings fmt.Println("String 1:", p) fmt.Println("String 2:", q) // Using the Split Function and regexp r := regexp.MustCompile(`[ns]`) s := r.Split(p, -2) t := strings.Split(q, "Lang") u := strings.Split(p, "") // Display the Split Output fmt.Println("Split String 1: ", s) fmt.Println("Split String 2: ", t) fmt.Println("Split String 1 with delimiter:", u) }
GoLinuxCloud
golinuxcloud.com › home › programming › split a string in go: strings.split, fields, cut, and splitn
Go split string, strings.Split, Fields, Cut, SplitN
December 25, 2022 - Cut is ideal when you only need to split once on the first separator and want two parts plus a found bool; SplitN is better when you need n-way splitting with the remainder in the last element. n less than zero returns all substrings; n zero returns nil; n positive caps how many substrings, with the remainder in the last element. ... Proficient in Golang, Python, Java, MongoDB, Selenium, Spring Boot, Kubernetes, Scrapy, API development, Docker, Data Scraping, PrimeFaces, Linux, Data Structures, and Data Mining.
IncludeHelp
includehelp.com › golang › strings-split-function-with-examples.aspx
Golang strings.Split() Function with Examples
August 19, 2021 - The return type of Split() function is a []string, it returns a slice of the substrings between those separators. // Golang program to demonstrate the // example of strings.Split() Function package main import ( "fmt" "strings" ) func main() { fmt.Printf("%q\n", strings.Split("The sun is very ...
Code Dodle
codedodle.com › home › tutorials › 4 ways to split string into subtrings in go
4 Ways to Split String into Subtrings in Go - Code Dodle
November 9, 2022 - In this tutorial, I’ll share with you four ways to split a string into a slice of substrings in Go. We’ll be using these 4 functions from Go’s strings package for the slicing task:- func Split(s, sep string) []string func SplitN(s, sep string, n int) []string func SplitAfter(s, sep string) []string func SplitAfterN(s, sep string,...