Skip to content

Instantly share code, notes, and snippets.

@tpdns90321
Created April 12, 2016 11:51
Show Gist options
  • Save tpdns90321/7c9f753bb5a24a5db6bd89b7962cfc30 to your computer and use it in GitHub Desktop.
Save tpdns90321/7c9f753bb5a24a5db6bd89b7962cfc30 to your computer and use it in GitHub Desktop.
package SplitLineRe
import "regexp"
func SplitLineRe(raw string) []string{
return regexp.MustCompile("((\r)\n)").Split(raw,-1)
}
package SplitLineRe
import "fmt"
func ExampleSplitLineRe(){
raw := "Hello, WOrld,\r\nWe are the world\nhello"
for _,x := range SplitLineRe(raw){
fmt.Println(x)
}
//Output:
//Hello, WOrld,
//We are the world
//hello
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment