Skip to content

Commit

Permalink
Fix string formatting for localized strings in material3 to correctly…
Browse files Browse the repository at this point in the history
… handle %N$d and %N$s strings.
  • Loading branch information
m-sasha committed Mar 4, 2024
1 parent cbb519d commit 127b3fd
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,9 @@ internal actual value class Strings(val value: Int) {
internal actual fun String.format(vararg formatArgs: Any?): String {
var result = this
formatArgs.forEachIndexed { index, arg ->
result = result.replace("%${index+1}$", arg.toString())
result = result
.replace("%${index+1}\$d", arg.toString())
.replace("%${index+1}\$s", arg.toString())
}
return result
}
Expand Down

0 comments on commit 127b3fd

Please sign in to comment.