I have a mutable list of strings and I'm trying to remove a word from each of them. The problem is that I don't believe the word is being removed from each line.
for (item in stringLines) {
when {
item.contains("SUMMARY") -> eventLines.add(item)
item.contains("DTSTART") -> startDateLines.add(item)
item.contains("DTEND") -> endDateLines.add(item)
//item.contains("URL:") -> locationLines.add(item)
//item.contains("CATEGORIES") -> categoriesLines.add(item)
}
}
for (item in eventLines) {
when{
item.contains("SUMMARY") -> item.removePrefix("SUMMARY")
}
}
The string is
SUMMARY WINTER FORMAL
and I need
WINTER FORMAL
but whatever reason it just doesn't appear. I know how to do this in java but I have no idea how to do this in Kotlin and I could not find any function that was able to accomplish this. What am I missing?