Tripple
Tripple

Reputation: 31

How do I convert a List of Chars to a List of Strings in Kotlin?

So I have a List of Chars [, , ] as example, but I want it to be ["","",""]

How can I make this happen? All I find on the Internet is how to convert a list to a string, but as I said that's not what I want. Any help?

Thanks in advance

Upvotes: 3

Views: 530

Answers (1)

d_eder
d_eder

Reputation: 58

You only have to use the map function on the list:

val strings = listOf('a','b').map{it.toString()}
print(strings)

Upvotes: 3

Related Questions