2023-06-05 16:37:37 +03:00
|
|
|
package OOP.Java.lab_5
|
|
|
|
|
2023-06-05 17:11:49 +03:00
|
|
|
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)
|
|
|
|
}
|
2023-06-05 16:37:37 +03:00
|
|
|
}
|