[Bro-Dev] [JIRA] (BIT-1097) Unexpected string indexing behavior

2013-12-05 Thread Robin Sommer (JIRA)

 [ 
https://bro-tracker.atlassian.net/browse/BIT-1097?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Robin Sommer updated BIT-1097:
--

Resolution: Merged  (was: Fixed)
Status: Closed  (was: Merge Request)

 Unexpected string indexing behavior
 ---

 Key: BIT-1097
 URL: https://bro-tracker.atlassian.net/browse/BIT-1097
 Project: Bro Issue Tracker
  Issue Type: Problem
  Components: Bro
Affects Versions: 2.2
Reporter: Robin Sommer

 Playing with string indexing/slicing, I'm seeing some (I think) non-intuitive 
 behavior:
 {code}
 global s = 012345;
 print A;
 print s[1:-1];
 print s[1:-2];
 print s[1:-3];
 print s[1:-4];
 print s[1:-5];
 print s[1:-6];
 print s[1:-7];
 print s[1:-8];
 print s[1:-9];
 print ;
 print B;
 print s[-1:-1];
 print s[-1:-2];
 print s[-1:-3];
 print s[-1:-4];
 {code}
 This prints:
 {code}
 A
 12345
 1234
 123
 12
 1
 12345
 12345
 12345
 B
 5
 5
 5
 {code}
 I would instead have expected:
 (1) A to print empty lines for all cases with the 2nd index = -6?
 (2) B to print empty lines for all cases with the 2nd index = -2?
 So, is this intentional? 



--
This message was sent by Atlassian JIRA
(v6.2-OD-03#6206)
___
bro-dev mailing list
bro-dev@bro.org
http://mailman.icsi.berkeley.edu/mailman/listinfo/bro-dev


[Bro-Dev] [JIRA] (BIT-1097) Unexpected string indexing behavior

2013-12-04 Thread Jon Siwek (JIRA)

[ 
https://bro-tracker.atlassian.net/browse/BIT-1097?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14904#comment-14904
 ] 

Jon Siwek commented on BIT-1097:


{quote}
how does one get everything until the end of the string? Python has a[5:] for 
that.
{quote}

{{a[5:|5|]}} ?  I.e. {{a[5:]}} is like {{a[5:len(a)]}} in Python.  Probably 
wouldn't be hard to add the shorthand, I can take a look.

 Unexpected string indexing behavior
 ---

 Key: BIT-1097
 URL: https://bro-tracker.atlassian.net/browse/BIT-1097
 Project: Bro Issue Tracker
  Issue Type: Problem
  Components: Bro
Affects Versions: 2.2
Reporter: Robin Sommer

 Playing with string indexing/slicing, I'm seeing some (I think) non-intuitive 
 behavior:
 {code}
 global s = 012345;
 print A;
 print s[1:-1];
 print s[1:-2];
 print s[1:-3];
 print s[1:-4];
 print s[1:-5];
 print s[1:-6];
 print s[1:-7];
 print s[1:-8];
 print s[1:-9];
 print ;
 print B;
 print s[-1:-1];
 print s[-1:-2];
 print s[-1:-3];
 print s[-1:-4];
 {code}
 This prints:
 {code}
 A
 12345
 1234
 123
 12
 1
 12345
 12345
 12345
 B
 5
 5
 5
 {code}
 I would instead have expected:
 (1) A to print empty lines for all cases with the 2nd index = -6?
 (2) B to print empty lines for all cases with the 2nd index = -2?
 So, is this intentional? 



--
This message was sent by Atlassian JIRA
(v6.2-OD-03#6206)
___
bro-dev mailing list
bro-dev@bro.org
http://mailman.icsi.berkeley.edu/mailman/listinfo/bro-dev


[Bro-Dev] [JIRA] (BIT-1097) Unexpected string indexing behavior

2013-12-04 Thread Jon Siwek (JIRA)

[ 
https://bro-tracker.atlassian.net/browse/BIT-1097?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14905#comment-14905
 ] 

Jon Siwek commented on BIT-1097:


That's in the branch now.

 Unexpected string indexing behavior
 ---

 Key: BIT-1097
 URL: https://bro-tracker.atlassian.net/browse/BIT-1097
 Project: Bro Issue Tracker
  Issue Type: Problem
  Components: Bro
Affects Versions: 2.2
Reporter: Robin Sommer

 Playing with string indexing/slicing, I'm seeing some (I think) non-intuitive 
 behavior:
 {code}
 global s = 012345;
 print A;
 print s[1:-1];
 print s[1:-2];
 print s[1:-3];
 print s[1:-4];
 print s[1:-5];
 print s[1:-6];
 print s[1:-7];
 print s[1:-8];
 print s[1:-9];
 print ;
 print B;
 print s[-1:-1];
 print s[-1:-2];
 print s[-1:-3];
 print s[-1:-4];
 {code}
 This prints:
 {code}
 A
 12345
 1234
 123
 12
 1
 12345
 12345
 12345
 B
 5
 5
 5
 {code}
 I would instead have expected:
 (1) A to print empty lines for all cases with the 2nd index = -6?
 (2) B to print empty lines for all cases with the 2nd index = -2?
 So, is this intentional? 



--
This message was sent by Atlassian JIRA
(v6.2-OD-03#6206)
___
bro-dev mailing list
bro-dev@bro.org
http://mailman.icsi.berkeley.edu/mailman/listinfo/bro-dev


[Bro-Dev] [JIRA] (BIT-1097) Unexpected string indexing behavior

2013-12-03 Thread Jon Siwek (JIRA)

 [ 
https://bro-tracker.atlassian.net/browse/BIT-1097?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Jon Siwek updated BIT-1097:
---

Status: Merge Request  (was: Open)

 Unexpected string indexing behavior
 ---

 Key: BIT-1097
 URL: https://bro-tracker.atlassian.net/browse/BIT-1097
 Project: Bro Issue Tracker
  Issue Type: Problem
  Components: Bro
Affects Versions: 2.2
Reporter: Robin Sommer

 Playing with string indexing/slicing, I'm seeing some (I think) non-intuitive 
 behavior:
 {code}
 global s = 012345;
 print A;
 print s[1:-1];
 print s[1:-2];
 print s[1:-3];
 print s[1:-4];
 print s[1:-5];
 print s[1:-6];
 print s[1:-7];
 print s[1:-8];
 print s[1:-9];
 print ;
 print B;
 print s[-1:-1];
 print s[-1:-2];
 print s[-1:-3];
 print s[-1:-4];
 {code}
 This prints:
 {code}
 A
 12345
 1234
 123
 12
 1
 12345
 12345
 12345
 B
 5
 5
 5
 {code}
 I would instead have expected:
 (1) A to print empty lines for all cases with the 2nd index = -6?
 (2) B to print empty lines for all cases with the 2nd index = -2?
 So, is this intentional? 



--
This message was sent by Atlassian JIRA
(v6.2-OD-03#6206)
___
bro-dev mailing list
bro-dev@bro.org
http://mailman.icsi.berkeley.edu/mailman/listinfo/bro-dev


[Bro-Dev] [JIRA] (BIT-1097) Unexpected string indexing behavior

2013-11-25 Thread Robin Sommer (JIRA)
Robin Sommer created BIT-1097:
-

 Summary: Unexpected string indexing behavior
 Key: BIT-1097
 URL: https://bro-tracker.atlassian.net/browse/BIT-1097
 Project: Bro Issue Tracker
  Issue Type: Problem
  Components: Bro
Affects Versions: 2.2
Reporter: Robin Sommer


Playing with string indexing/slicing, I'm seeing some (I think) non-intuitive 
behavior:

{code}
global s = 012345;

print A;
print s[1:-1];
print s[1:-2];
print s[1:-3];
print s[1:-4];
print s[1:-5];
print s[1:-6];
print s[1:-7];
print s[1:-8];
print s[1:-9];

print ;

print B;
print s[-1:-1];
print s[-1:-2];
print s[-1:-3];
print s[-1:-4];
{code}

This prints:

{code}
A
12345
1234
123
12
1

12345
12345
12345

B
5

5
5
{code}

I would instead have expected:

(1) A to print empty lines for all cases with the 2nd index = -6?

(2) B to print empty lines for all cases with the 2nd index = -2?

So, is this intentional? 



--
This message was sent by Atlassian JIRA
(v6.2-OD-03#6206)
___
bro-dev mailing list
bro-dev@bro.org
http://mailman.icsi.berkeley.edu/mailman/listinfo/bro-dev