mirror of
https://github.com/zeek/zeek.git
synced 2025-10-17 05:58:20 +00:00
Fixes #4076; update BIFs to_int() and to_count() to accept optional 'base' argument for more easy conversions of strings representing (for example) hexadecimal, octal, or binary numbers
This commit is contained in:
parent
9c41b6d227
commit
0b81bf5ad3
5 changed files with 16 additions and 4 deletions
|
@ -6,6 +6,9 @@
|
|||
7
|
||||
0
|
||||
18446744073709551611
|
||||
172
|
||||
35
|
||||
195
|
||||
0
|
||||
123
|
||||
9223372036854775808 and 9223372036854775808 are the same
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
||||
1
|
||||
-1
|
||||
188
|
||||
39
|
||||
243
|
||||
4294967296
|
||||
0
|
||||
3
|
||||
|
|
|
@ -19,6 +19,9 @@ event zeek_init()
|
|||
print to_count("7");
|
||||
print to_count("");
|
||||
print to_count("-5");
|
||||
print to_int("10101100", 2);
|
||||
print to_int("43", 8);
|
||||
print to_int("C3", 16);
|
||||
print to_count("not a count");
|
||||
|
||||
local e: port = 123/tcp;
|
||||
|
|
|
@ -6,6 +6,9 @@ event zeek_init()
|
|||
{
|
||||
print to_int("1");
|
||||
print to_int("-1");
|
||||
print to_int("10111100", 2);
|
||||
print to_int("47", 8);
|
||||
print to_int("F3", 16);
|
||||
print to_int("4294967296");
|
||||
print to_int("not an int");
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue