Skip to content

mghyo/go-linebreak

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

go-linebreak

Go Reference Go Report Card

Installation

go get -u github.com/mghyo/go-linebreak

Purpose

The purpose of this package is to allow text files to be split up in a platform-agnostic manner.

  • On Windows the newline character is "\r\n"
  • On linux/darwin the newline character is "\n"

I wanted a way to split strings wihtout platform specific code in my codebase.

Usage

package main

import (
	"fmt"
	"strings"

	"github.com/mghyo/go-linebreak"
)

func main() {
	var str string
	str = "asd\nfgh\njkl"
	lines := strings.Split(str, linebreak.Linebreak)

	for _, line := range lines {
		fmt.Println(line)
	}
}

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages