"Sputnik" help  
Sputnik Help
BinaryStartsWith(<binary>,<needle>,[<ignoreCase>])

Description

Checks whether a binary string starts with a specific needle. The function performs a case-sensitive comparison by default, but the comparison can be made case-insensitive by setting the optional parameter ignoreCase to true.

Parameters

<binary> The binary string to be checked.
<needle> The needle string to match against the end of the binary string.
<ignoreCase> Optional boolean value indicating whether the comparison should be case-insensitive. (Defaults: false)

Return Value

Success: Returns true.
Failure: Returns false.

Remarks

The comparison is performed based on the ASCII character mapping. The function checks whether the binary string starts wuth the needle string. By default, the comparison is case-sensitive, meaning that the function distinguishes between uppercase and lowercase characters. To perform a case-insensitive comparison, set the ignoreCase parameter to true.

Related

BinaryEndsWith

Example

Basic example:

my $bin = (Binary)"Hello World";
say BinaryStartsWith($bin, (Binary)"Hello");
say BinaryStartsWith($bin, (Binary)"HellO");
say BinaryStartsWith($bin, (Binary)"HellO", true);
// PRINTS
// true
// false
// true

 


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