Use the extension String.toByteArray() – which means you will write myString.toByteArray(). Note it defaults to UTF-8 encoding, but you can override this by providing an additional argument.
Use the extension String.toByteArray() – which means you will write myString.toByteArray(). Note it defaults to UTF-8 encoding, but you can override this by providing an additional argument.