title: strings.Split in Go
body: <p>The file names.txt consists of many names in the form of:</p>
  
  <pre><code>"KELLEE","JOSLYN","JASON","INGER","INDIRA","GLINDA","GLENNIS"
  </code></pre>
  
  <p>Does anyone know how to split the string so that it is individual names separated by commas?</p>
  
  <pre><code>KELLEE,JOSLYN,JASON,INGER,INDIRA,GLINDA,GLENNIS
  </code></pre>
  
  <p>The following code splits by comma and leaves quotes around the name, what is the escape character to split out the <code>"</code>. Can it be done in one Split statement, splitting out <code>","</code> and leaving a comma to separate?</p>
  
  <pre><code>package main
  
  import "fmt"
  import "io/ioutil"
  import "strings"
  
  func main() {
          fData, err := ioutil.ReadFile("names.txt")  // read in the external file
      if err != nil {
          fmt.Println("Err is ", err)     // print any error
      }
      strbuffer := string(fData)  // convert read in file to a string
  
      arr := strings.Split(strbuffer, ",")
  
      fmt.Println(arr)
  
  }
  </code></pre>
  
  <p>By the way, this is part of Project Euler problem # 22. <a href="http://projecteuler.net/problem=22" rel="noreferrer">http://projecteuler.net/problem=22</a> </p>