mirror of
https://github.com/Suwayomi/TachideskJUI.git
synced 2025-12-10 06:42:05 +01:00
Add Multiplatform capitalize method
This commit is contained in:
@@ -20,6 +20,8 @@ fun String.chop(count: Int, replacement: String = "…"): String {
|
||||
}
|
||||
}
|
||||
|
||||
expect fun String.capitalize(locale: Locale = Locale.current): String
|
||||
|
||||
expect fun String.uppercase(locale: Locale): String
|
||||
|
||||
expect fun String.lowercase(locale: Locale): String
|
||||
|
||||
@@ -9,7 +9,7 @@ package ca.gosyer.jui.core.lang
|
||||
|
||||
import androidx.compose.ui.text.intl.Locale
|
||||
|
||||
fun String.capitalize(locale: Locale = Locale.current) =
|
||||
actual fun String.capitalize(locale: Locale) =
|
||||
replaceFirstChar { if (it.isLowerCase()) it.titlecase(locale) else it.toString() }
|
||||
|
||||
actual fun String.uppercase(locale: Locale): String = uppercase(locale.toPlatform())
|
||||
|
||||
Reference in New Issue
Block a user