``` println("hello".apply { replace("h", "H") ...
# codereview
h
Copy code
println("hello".apply {
		replace("h", "H")
	})
}
l
String’s replace returns a new string
2
a
Did your version work?
l
apply
returns the same object
h
soo.. should i use somrhing else?
l
in this case you probably want
run
, it returns the result from the inner block
h
kk
a
don't need anything, simply chain the replacements together:
Copy code
val value = Base64.getEncoder().encodeToString(bytes)
                          .replace(...)
                          .replace(...)
h
i just did this:
Copy code
val value = Base64.getEncoder().encodeToString(bytes).run {
		replace("+", "-").replace("/", "_").replace("=", "")
	}
¯\_(ツ)_/¯
same thing, ahah
😂 1
i’ll just rmeove the run then