Created
March 25, 2012 21:09
-
-
Save sfreiberg/2199780 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, `@`) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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