How to call String.getBytes()?


I want to call String.getBytes(), but the editor says the method is unknown & the compiler gives me an unresolved reference.

This seems like a bug.

KT-7995 may be related, but getBytes() itself isn’t deprecated (although one of its overloads is deprecated).

Is there a workaround?



Use String.toByteArray() extension:


Thanks Ilya.

Was this method purposefully hidden?