ToBytes
Name | ToBytes |
Syntax | ToBytes (String str, String codePage) |
Purpose | To return a byte array in the given encoding. |
Description | Returns and array of bytes. Good as an intermediate structure to be used with other functions. |
Return Type | Byte |
Parameters | str [System.String] – The string to convert codepage [System.String] – The code page that string is currently encoded in. Default is UTF-8. |
![](https://documentation.astera.com/~gitbook/image?url=https%3A%2F%2F3083465318-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FsR50Wa7EwZGlmPSAMkkf%252Fuploads%252Ff6GchnJ9pysuf59Dvctw%252F0.png%3Falt%3Dmedia&width=768&dpr=4&quality=100&sign=3e666774&sv=1)
Example
In this example, we are passing the required parameters to the function transformation object using a Variables object.
Where,
str = Hello World
codepage = UTF-8 (Default)
![](https://documentation.astera.com/~gitbook/image?url=https%3A%2F%2F3083465318-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FsR50Wa7EwZGlmPSAMkkf%252Fuploads%252FUsI740yoOd5TRmAt0Aa6%252F1.png%3Falt%3Dmedia&width=768&dpr=4&quality=100&sign=4ef44c17&sv=1)
Right-click on the function transformation object and select Preview Output. You can see that Astera has returned the byte value of the specified UTF-8 string.
![](https://documentation.astera.com/~gitbook/image?url=https%3A%2F%2F3083465318-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FsR50Wa7EwZGlmPSAMkkf%252Fuploads%252Ffw43voWdNolVzJuXyRPG%252F2.png%3Falt%3Dmedia&width=768&dpr=4&quality=100&sign=30e56abe&sv=1)
Last updated