I am trying to use all features of kotlin, but seems not of them are working, or may be it's my fault.
So, apply
to String
not work. Example:
val str = someStr.apply {
toUpperCase()
if (contains("W")) replace("W", "w")
}
Input -> xywz
Output -> xywz
Expected -> XYwZ
Java style:
val str = it.text().toString().toUpperCase()
if (str.contains("W")) str.replace("W", "w")
Input -> xywz
Output -> XYwZ
Expected -> XYwZ
Am I doing something wrong?