Commit graph

4 commits

Author SHA1 Message Date
Christian Kreibich
0b674eb851 Baseline refresh to reflect btest 0.64 2020-12-06 20:19:49 -08:00
Jon Siwek
8515d3aa57 Support omission of string slice low/high indices, BIT-1097.
Omission of the low index defaults to 0:

    s = "12345"; s[:3] == "123"

Omission of the high index defaults to length of the string:

    s = "12345"; s[3:] == "45"
2013-12-04 15:11:48 -06:00
Jon Siwek
4014cdc277 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.
2013-12-03 14:39:21 -06:00
Jon Siwek
55c515d50a Add array-style index accessor for strings. Addresses #422.
The index expression can take up to two indices for the start and end
index of the substring to return (e.g. "mystring[1,3]").  Negative
indices are allowed, with -1 representing the last character in the
string.  The indexing is not cyclic -- if the starting index is >= the
length of the string an empty string is returned, and if the ending
index is >= the length of the string then it's interpreted as the last
index of the string.  Assigning to substrings accessed like this isn't
allowed.
2012-12-20 17:13:06 -06:00