Ink
10/26/2022, 8:44 AMname: tom, weight: 50, age: 21
How I can get value name
, weight
, age
?andylamax
10/26/2022, 8:48 AM"name: tom, weight: 50, age: 21".split(",").map {
it.split(":").first()
}.joinToString(",")
Ink
10/26/2022, 8:52 AMname
, weight
, age.
andylamax
10/26/2022, 8:55 AM"name: tom, weight: 50, age: 21".split(",").map {
it.split(":")[1]
}.joinToString(",")
Ink
10/26/2022, 8:56 AMInk
10/26/2022, 9:25 AMgildor
10/26/2022, 9:32 AMval (name, weight, age) = "name: tom, weight: 50, age: 21".split(",").map {
it.split(":")[1]
}
gildor
10/26/2022, 9:33 AMInk
10/26/2022, 9:37 AMresult
?andylamax
10/26/2022, 9:38 AMval result = "name: tom, weight: 50, age: 21".split(",").map {
it.split(":")[1]
}
Ink
10/26/2022, 9:42 AMMichael de Kaste
10/26/2022, 11:01 AMgildor
10/26/2022, 11:08 AMSam
10/26/2022, 11:36 AMSome people, when confronted with a problem, think “I know, I’ll use regular expressions.” Now they have two problems.
Michael de Kaste
10/26/2022, 12:00 PMAlan B
10/26/2022, 12:34 PMgildor
10/26/2022, 1:22 PM