Skip to content

Commit

Permalink
Fix format method on JVM and JS
Browse files Browse the repository at this point in the history
  • Loading branch information
iSoron committed May 17, 2020
1 parent c784f40 commit 5f83314
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
12 changes: 10 additions & 2 deletions core/src/main/js/org/isoron/platform/io/JsStrings.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
11 changes: 8 additions & 3 deletions core/src/main/jvm/org/isoron/platform/io/Strings.kt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@

package org.isoron.platform.io

actual fun sprintf(format: String, vararg args: Any?): String {
return String.format(format, *args)
}
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)

0 comments on commit 5f83314

Please sign in to comment.