Codes the string of characters in a sequence of bytes usin the game of characters by default of the platform and stores the result in a new array of bytes.

1 string.getBytes

<string.getBytes encoding='encoding'>
    <value /> +
</string.getBytes>

Exceptions

requires 1 arguments, received: ...

The entry parameter has been specified.

java.io.UnsupportedEncodingException

The coding type indicated is not supported.

Example

Shows the length of a string of characaters.

Copy
<xsql-script name='string_getBytes'>
    <body>
        <println>
            <string.getBytes encoding='ascii'><string>a</string></string.getBytes>
        </println>

        <println>
            <string.getBytes encoding='utf-8'><string>é</string></string.getBytes>
        </println>

        <println>
            <byte.length>
                <string.getBytes encoding='ascii'><string>a</string></string.getBytes>
            </byte.length>
        </println>

        <println>
            <byte.length>
                <string.getBytes encoding='utf-8'><string>é</string></string.getBytes>
            </byte.length>
        </println>
    </body>
</xsql-script>

Returns:

Copy
a
é
1
2