Home > other >  Convert IntRange to listOf String in Kotlin
Convert IntRange to listOf String in Kotlin

Time:05-08

I want to convert a IntRange:

val years = 1900..2020

to a listOf<String> with all the values from 1900 to 2022, how do I do it?

I need it as a String list cause I'm passing it with other String lists into an composable.

CodePudding user response:

val listOfStings = years.map { it.toString() }

  • Related