"Sputnik" help  
Sputnik Help
BinarySet(<binary>, <index>, <value>)

Description

Sets the byte value at the specified index in the binary string.

Parameters

<binary> The binary string in which to set the byte value.
<index> The index of the byte to set. The index starts from 0.
<value> The byte value (an integer) to set at the specified index.

Return Value

Success: Returns true.
Failure: Returns false.

Remarks

The BinarySet function allows you to modify individual bytes within a binary string. It takes a binary string, an index, and a byte value as input, and sets the byte value at the specified index in the binary string. The index starts from 0, where 0 represents the first byte of the binary string. This function is useful when you need to update specific byte values within a binary string.

Related

BinaryGet

Example

Example get/set binary data:

my $binary = Bin("Cat");
BinarySet($binary, 0, 65);
BinarySet($binary, 2, 87);
say (Char)BinaryGet($binary, 0);
say BinaryGet($binary, 1);
say (Char)BinaryGet($binary, 2);
say $binary;
// PRINTS
// A
// 97
// W
// AaW

 


Contact
Cheryl (uberfox@hotmail.com)
Homepage
http://ubersoft.org