Skip to content

Instantly share code, notes, and snippets.

@sfreiberg
Created March 25, 2012 21:09
Show Gist options
  • Save sfreiberg/2199780 to your computer and use it in GitHub Desktop.
Save sfreiberg/2199780 to your computer and use it in GitHub Desktop.
package main
import (
"bufio"
"fmt"
"io"
"os"
"strings"
)
func main() {
inputFile, inputError := os.Open("test.txt")
if inputError != nil {
fmt.Println("An error happened.")
}
defer inputFile.Close()
inputReader := bufio.NewReader(inputFile)
for {
inputString, readerError := inputReader.ReadString('\n')
if readerError == io.EOF {
return
}
strings.Split(inputString, `@`)
}
}
file = File.open 'test.txt'
file.each_line do |line|
line.split('@')
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment