Blob
PowerScript function
Converts a string or byte array to a blob.
Syntax 1: Convert
a string to a blob
Description
Converts a string to a blob datatype.
Syntax
1 |
Blob ( text {, encoding} ) |
Argument |
Description |
---|---|
text |
The string you want to convert to a blob |
encoding |
Character encoding of the resulting blob. Values
|
Return value
Blob.
Returns the converted string in a blob with the requested encoding,
if specified. If text is null, Blob returns null.
Usage
If the encoding argument is not provided, Blob converts a Unicode
string to a Unicode blob. You must provide the encoding argument if the
blob has a different encoding.
Examples
This example saves a text string as a Unicode blob:
1 2 |
Blob B B = Blob("Any Text") |
This example saves a text string as a blob with UTF-8
encoding:
1 2 |
Blob Blb Blb = Blob("Any Text", EncodingUTF8!) |
See also
Syntax 2: Convert a string or a byte array to a blob
Description
Converts a string or an array of bytes to a blob datatype.
Syntax
1 |
Blob ( array[ ] ) |
Argument |
Description |
---|---|
stringorbytearray |
An Any variable that holds a string or an array of |
Return value
Blob.
Returns the converted string or byte array in a blob.
Examples
This example saves an array of bytes as a blob, then copies the
contents of the blob to another byte array:
1 2 3 4 5 6 7 8 9 10 |
Blob lblb_1 Any a byte lbyte_array[], lbyte_array2[] // initialize array lbyte_array[] = {1,10,100,200,255} a = lbyte_arraylblb_1 = Blob(a) lbyte_array2[] = GetByteArray(lblb_1) |
See also