Answer the question
In order to leave comments, you need to log in
How to solve a problem in Kotlin?
Hello!
There is a multiline text like this:
6 need 10 GiB Tue May 12 10:14:09 2020 10 GiB Tue May 12 10:14:09 2020 1
gitlab-database-2020-05-12-10-00-00
25 21:59:59 2020
3 gitlab-database-2020-05-12-10-00-00 10 GiB Tue May 12 10:14:09 2020
4 gitlab-database-2020-05-12-10-00-00 10 GiB Tue May 12 10:14:09 2020
5 gitlab-
database-2020-05-12-10-00-00 -00-00 10 GiB Tue May 12 10:14:09 2020
9 2020-05-20-19-00-00 10 GiB Wed May 20 19:49:22 2020
11 2020-05-25-hjhhjbg 10 GiB Mon May 25 21:59:59 2020
Answer the question
In order to leave comments, you need to log in
1) Split into lines (split)
2) Parse each line with a regular expression (regexp) and add it to an object with two fields (first and second)
3) Sort the list of objects (sort)
4) Take the required number of objects from the list (take / drop)
...
Profit!
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question