Lab 5, progress.
This commit is contained in:
parent
2ddeaab94f
commit
46d339f31e
|
@ -8,4 +8,8 @@ class Punctuation(var punctuationMark: String) {
|
|||
this.punctuationMark = ""
|
||||
}
|
||||
}
|
||||
|
||||
override fun toString(): String {
|
||||
return punctuationMark
|
||||
}
|
||||
}
|
|
@ -1,4 +1,12 @@
|
|||
package OOP.Java.lab_5
|
||||
|
||||
class Sentence {
|
||||
class Sentence(sentenceString: String) {
|
||||
init {
|
||||
var split = sentenceString.split("(\\p{Punct}? )|(\\p{Punct})".toRegex())
|
||||
var punctuation: Array<Punctuation> = sentenceString.split(" ").map { word -> Punctuation(word.last().toString()) }.toTypedArray()
|
||||
for (elem in split) {
|
||||
println(elem)
|
||||
}
|
||||
print(split)
|
||||
}
|
||||
}
|
|
@ -9,5 +9,5 @@ class Word(var letters: Array<Letter>) {
|
|||
}
|
||||
constructor(
|
||||
word: String
|
||||
) : this((word.toCharArray().map { n -> Letter(n) }).toTypedArray())
|
||||
) : this((word.toCharArray().map { letter -> Letter(letter) }).toTypedArray())
|
||||
}
|
Loading…
Reference in New Issue