Add utility function SplitIntoLines.

This commit is contained in:
Amy Boyd
2016-06-25 12:28:23 +01:00
parent 0f79e76b46
commit e99a80940f
2 changed files with 16 additions and 0 deletions

View File

@@ -24,6 +24,12 @@ func ContainsString(haystack []string, needle string) bool {
return false
}
var lineEndingsRegexp = regexp.MustCompile("(\r\n|\n|\r)")
func SplitIntoLines(s string) []string {
return lineEndingsRegexp.Split(s, -1)
}
func ExitBecauseOfInternalError(err string) {
fmt.Println(err)
os.Exit(2)