Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could use "split" w/o regex #1

Closed
nkiesel opened this issue Dec 2, 2021 · 1 comment
Closed

Could use "split" w/o regex #1

nkiesel opened this issue Dec 2, 2021 · 1 comment
Assignees

Comments

@nkiesel
Copy link
Owner

nkiesel commented Dec 2, 2021

return input.asSequence().map { s -> s.split(Regex(" ")) }.map { it[0] to it[1].toInt() }

(Just trying out how to comment on code in github....)

You could use s.split(" ") instead of s.split(" ".toRegex()) (Kotlin has overloaded split for String and Regex argument)

@prasad-babu
Copy link
Collaborator

updated using split(" ")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants