From 5f83314d56ab133d497b9339849e176b6cb34b10 Mon Sep 17 00:00:00 2001 From: Alinson Xavier Date: Sun, 17 May 2020 13:33:22 -0500 Subject: [PATCH] Fix format method on JVM and JS --- core/src/main/js/org/isoron/platform/io/JsStrings.kt | 12 ++++++++++-- core/src/main/jvm/org/isoron/platform/io/Strings.kt | 11 ++++++++--- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/core/src/main/js/org/isoron/platform/io/JsStrings.kt b/core/src/main/js/org/isoron/platform/io/JsStrings.kt index 6abbc4675..2d583967c 100644 --- a/core/src/main/js/org/isoron/platform/io/JsStrings.kt +++ b/core/src/main/js/org/isoron/platform/io/JsStrings.kt @@ -19,6 +19,14 @@ package org.isoron.platform.io -actual fun sprintf(format: String, vararg args: Any?): String { - return js("vsprintf")(format, args) +actual fun format(format: String, arg: String): String { + return js("vsprintf")(format, arg) as String +} + +actual fun format(format: String, arg: Int): String { + return js("vsprintf")(format, arg) as String +} + +actual fun format(format: String, arg: Double): String { + return js("vsprintf")(format, arg) as String } \ No newline at end of file diff --git a/core/src/main/jvm/org/isoron/platform/io/Strings.kt b/core/src/main/jvm/org/isoron/platform/io/Strings.kt index de3b612c7..edb787583 100644 --- a/core/src/main/jvm/org/isoron/platform/io/Strings.kt +++ b/core/src/main/jvm/org/isoron/platform/io/Strings.kt @@ -19,6 +19,11 @@ package org.isoron.platform.io -actual fun sprintf(format: String, vararg args: Any?): String { - return String.format(format, *args) -} \ No newline at end of file +actual fun format(format: String, arg: String): String = + String.format(format, arg) + +actual fun format(format: String, arg: Int): String = + String.format(format, arg) + +actual fun format(format: String, arg: Double): String = + String.format(format, arg) \ No newline at end of file