Anyone knows how can I fill the placeholder `total...
# android
a
Anyone knows how can I fill the placeholder
total
with the value for this string:
"%{total} price for the Pizza"
u
val total =123 val message = "% $total price for the Pizza" print(message)
a
I didn't get you can you share the kotlin code?
u
Screenshot_20220203-212641.png
a
Or in case you can't modify the string to change it from using % to instead using valid Kotlin string interpolation you might have to settle for something like `.replace(..., ...)`: https://pl.kotl.in/eRum81i4g
a
ahh that's a bit hacky to use
replace
for this. I thought there is something simple already in kotlin for filling this
%{}
inside string
@Umar Ata my string is different than you. I already know your case
u
Can write the expected output
a
val total = 5
"5 price for the Pizza"
u
The string you have "%{total} price for the Pizza" Is coming from strings file or from an api
a
from an API