Skip to content
Snippets Groups Projects
Commit 6c7a6e6a authored by Kaj Koivunen's avatar Kaj Koivunen :coffee:
Browse files

tiedoston erottimiksi ASCII 1&2

parent bcf403ae
No related branches found
No related tags found
No related merge requests found
......@@ -66,7 +66,7 @@ class Project {
var line: String?
while (reader.readLine().also { line = it } != null) {
println(line)
if (line!!.startsWith('#')) {
if (line!!.startsWith(1.toChar())) {
pages.add(Page())
} else {
pages.last().lines.add(Line(line!!))
......@@ -79,7 +79,7 @@ class Project {
file.printWriter().use { writer ->
var pageNumber = 1
for (page in pages) {
writer.println("#${pageNumber++}")
writer.println("${1.toChar()}${pageNumber++}")
page.save(writer)
}
}
......@@ -124,7 +124,7 @@ class Page(lines: Collection<Line> = listOf()) {
fun save(writer: PrintWriter) {
for (line in lines) {
with(line) {
writer.println("$original|$machineTranslation|$finalTranslation|$notes")
writer.println("$original${2.toChar()}$machineTranslation${2.toChar()}$finalTranslation${2.toChar()}$notes")
}
}
}
......@@ -144,7 +144,7 @@ data class Line(
var notes: String = ""
) {
constructor(s: String) : this() {
val args = s.split('|')
val args = s.split(2.toChar())
original = args.getOrElse(0) { "" }
machineTranslation = args.getOrElse(1) { "" }
finalTranslation = args.getOrElse(2) { "" }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment