Hello there :wave:, i am confused. I take user inp...
# getting-started
a
Hello there đŸ‘‹, i am confused. I take user input then in the user input it might be "bot take rest" and I converted it to list, then I need to verify(put in if else statement) the first 9 words or if the 9 word is "bot take" or another command. How can I do that 9 words ?
n
that’s a bit confusing perhaps you could explain the context?
a
Simply, I just want to take the first 9 words as string from the user input
v
But your example only has 3 words
To get the first 9 words as list you can for example do
Copy code
input.splitToSequence(' ', limit = 10).take(9).toList()
Or
Copy code
input.split("""\s+""".toRegex(), limit = 10).take(9)
a
@Vampire sorry, I mean letter but this way (that you tell me in the top) is much straight forward and easy than that I ask (with single letter) thank you very much đŸ˜ƒ
v
if ("bot take rest".startsWith("bot take ")) { ... }
a
Thanks this also helps