0Pricing
Kotlin Multiplatform Academy · Lesson

Strings, Numbers & Collections Everywhere

Core stdlib types that behave the same on all targets.

Strings, Numbers & Collections Everywhere is a free Kotlin Multiplatform Academy lesson on CoddyKit — lesson 1 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Kotlin Multiplatform Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.

One Toolbox, Every Target

The Kotlin stdlib ships with the language itself, so its core types behave the same on Android, iOS, desktop and beyond.

Strings Just Work

The String type is fully multiplatform. You can declare and combine text in commonMain and trust it everywhere.

val name: String = "Ada"
val hi = "Hello, " + name

String Helpers Travel With You

Handy String functions like uppercase, trim and length all live in common code, ready on each platform.

val tidy = "  hi  ".trim().uppercase()

Numbers Are Shared Too

Number types such as Int, Long and Double are part of common Kotlin, so your math is identical across targets.

val total: Int = 2 + 3
val price: Double = 9.99

Convert Between Types

Conversions like toInt and toDouble are common-safe, letting you reshape numbers anywhere your shared code runs.

val count = "42".toInt()
val ratio = count.toDouble()

Meet the List

A List holds an ordered group of items. It is multiplatform, so the same collection powers both apps.

val fruits: List<String> = listOf("apple", "pear")

Sets Keep Things Unique

A Set stores each value only once. Like List, it works the same way on every Kotlin target.

val tags: Set<String> = setOf("kmp", "kmp")

Maps Pair Keys and Values

A Map links keys to values. It is fully shared, so lookups behave identically across all platforms.

val ages: Map<String, Int> = mapOf("Ada" to 36)

Read Items Safely

Use indexing or getOrNull to read from a list. These collection operations are common-safe across targets.

val first = fruits[0]
val maybe = fruits.getOrNull(5)

Why This Matters

Because these core types are identical everywhere, you write data logic once and never worry which platform runs it. 🙂

Default to Common Types

Reach for plain String, Int, List, Set and Map first. They are the safe, portable backbone of shared Kotlin.

Quick Check

Which collection fits this need?

Recap

Core stdlib types, String, numbers, List, Set and Map, behave the same on every target, so shared data logic is rock solid.

Frequently asked questions

Is the “Strings, Numbers & Collections Everywhere” lesson free?

Yes — the full text of “Strings, Numbers & Collections Everywhere” is free to read here on the web, and the Kotlin Multiplatform Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Kotlin Multiplatform Academy course, upgrade to CoddyKit PRO.

What will I learn in “Strings, Numbers & Collections Everywhere”?

Core stdlib types that behave the same on all targets. You practise Kotlin Multiplatform Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start Kotlin Multiplatform Academy?

No prior experience is required. Kotlin Multiplatform Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 1 of 4, so you can start here or from the beginning and move at your own pace.

How long does the “Strings, Numbers & Collections Everywhere” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this Kotlin Multiplatform Academy lesson?

Yes. Every Kotlin Multiplatform Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. Strings, Numbers & Collections Everywhere
  2. map, filter & fold in Shared Code
  3. Dates with kotlinx-datetime
  4. What Is NOT in Common stdlib
← Back to Kotlin Multiplatform Academy