Fix string slice notation, addresses BIT-1097.

Slice ranges were not correctly determined for negative indices and also
off by one in general (included one more element at the end of the
substring than what actually matched the index range).

It's now equivalent to Python slice notation.  Accessing a string at
a single index is also the same as Python except that an out-of-range
index returns an empty string instead of throwing an expection.
This commit is contained in:
Jon Siwek 2013-12-03 14:39:21 -06:00
parent dc52846b6f
commit 4014cdc277
4 changed files with 187 additions and 14 deletions

View file

@ -60,7 +60,7 @@ event file_new(f: fa_file)
if ( f?$bof_buffer )
{
print "FILE_BOF_BUFFER";
print f$bof_buffer[0:10];
print f$bof_buffer[0:11];
}
if ( f?$mime_type )