title: How to insert a Character every X Characters in a String in Golang?
body: <p><strong>Aim:</strong> to insert a character every x characters in a string in Golang</p>
  
  <p><strong>Input:</strong> <code>helloworldhelloworldhelloworld</code></p>
  
  <p><strong>Expected Output:</strong> <code>hello-world-hello-world-hello-world</code></p>
  
  <p><strong>Attempts</strong></p>
  
  <p><em>Attempt one</em></p>
  
  <pre><code>package main
  
  import (
      "fmt"
      "strings"
  )
  
  func main() {
      s := "helloworldhelloworldhelloworld"
  
      s = strings.Replace(s, "world", ",", -1)
      fmt.Println(s)
  }
  </code></pre>
  
  <p>results in: <code>hello,hello,hello,</code></p>
  
  <hr>
  
  <p><em>Attempt two</em></p>
  
  <ol>
  <li>Count number of characters</li>
  <li>For loop</li>
  <li>If X=5 then insert a <code>-</code></li>
  </ol>
  
  <hr>
  
  <p><em>Attempt three</em></p>
  
  <ol>
  <li>Scan combined with join</li>
  </ol>
  
  <p><strong>Problem</strong></p>
  
  <p>The reason that attempts two and three do not contain code snippets at the moment is that I am still thinking what approach should be used to insert a character every X characters in a string in Golang.</p>