"Sputnik" help  
Sputnik Help
BinarySubStr(<binary>, <start>, [<length>])

Description

Returns a new binary string that is a substring of the original binary string.

Parameters

<binary> The original binary string.
<start> The starting index of the substring. It can be a positive or negative value. A negative value indicates counting from the end of the binary string. If not specified, the substring will start from the beginning of the binary string.
<length> Optional length of the substring. If not specified, the substring will include all the characters from the starting index to the end of the binary string. If specified, it can be a positive or negative value. A negative value indicates counting from the end of the binary string.

Return Value

Success: Returns a new binary string that is a substring of the original binary string.
Failure: Returns an empty binary string.

Remarks

The BinarySubStr function allows you to extract a portion of a binary string based on the specified starting index and length. If the starting index or length is negative, it is treated as counting from the end of the binary string.

Related

BinarySubStrReplace, BinaryMid, BinaryMidReplace

Example

Example of usage

my $binary = Bin("Hello, World");
my $result1 = BinarySubStr($binary, 7);
my $result2 = BinarySubStr($binary, 0, 5);
my $result3 = BinarySubStr($binary, -5);
say $result1;
say $result2;
say $result3;

// PRINTS
// World
// Hello
// World

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