evkaky
06/04/2024, 10:48 AMString to ByteArray in sdlib:
String.toByteArray(charset: Charset = Charsets.UTF_8): ByteArray
and
String.encodeToByteArray(): ByteArray
Why so? Why having both?
The second one looks redundant as it
• doesn't allow to provide charset
• has longer name, while clearness is the same as with shorter versionPHondogo
06/04/2024, 1:09 PMevkaky
06/04/2024, 1:41 PMtoByteArray - encodeToByteArray ) is?hho
06/04/2024, 2:00 PMtoByteArray method can't be multiplatform, because it uses a Java Charset as a parameter type. That's why the second method exists, I guess.
Methods which don't reference platform-specific stuff are usually multiplatform.evkaky
06/04/2024, 5:54 PMxoangon
06/04/2024, 10:15 PMAtul Gupta
06/06/2024, 7:41 AMCharset in String.encodeToByteArray(): ByteArray method?PHondogo
06/06/2024, 7:44 AM