Software Development

Kotlin – Convert comma-separated String to a List

[wp_ad_camp_1]

This post shows how to convert a comma-separated strings (CSVs) to a list and back. In Kotlin, we can create both immutable or mutable lists.

Requirements

  • IntelliJ IDEA Ultimate 2016.3
    • The Community Edition may be enough but we have not tried it.
  • Kotlin Version 1.1
  • Windows 10 Enterprise

CSV String to list

[wp_ad_camp_2]

Outputs:

List to CSV string

[wp_ad_camp_3]

Outputs:

References

[wp_ad_camp_4]

You Might Also Like