currently i have `Pair(str.split(Regex(" "), 2)[0]...
# getting-started
t
currently i have
Pair(str.split(Regex(" "), 2)[0], str.split(Regex(" "), 2)[1])
, i could also use indeces.. is there a more elegant way?
d
str.split(Regex(" "), 2).let { it[0] to it[1] }
?
👆 1
s
beat me to it lol
t
that gives a
Pair<Char, Char>
d
I think you have a typo. Maybe. 😬
t
yes i did
😬
i had created a copy and was changing the wrong method 😬
s
Copy code
str.split(" ", limit = 2).let { it[0] to it[1]}
t
that's nicer, thanks @Steven McLaughlin
s
made a slight edit to use
it[0] to it[1]
rather than
Pair(it[0], it[1])