Slackbot
04/18/2019, 8:01 AMPavlo Liapota
04/18/2019, 8:21 AMif (line.startsWith('/')) line.drop(1) else line
or
line.let {
if (it.startsWith('/')) it.drop(1) else it
}
Smallville7123
04/18/2019, 8:27 AMif (line.startsWith('/')) {
line.drop(1)
val str = StringBuilder()
val parser = Parser(line.toStack())
// modify the following, pulled from "fun String.collapse(token: String, replaceWith: String): String"
val t = parser.IsSequenceOneOrMany(" ")
while (parser.peek() != null) {
if (t.peek()) {
t.pop()
str.append(replaceWith)
}
else str.append(parser.pop()!!)
}
}
but make the drop(1) part of the if expression itself