GNOME Bugzilla – Bug 641268
Support for Python-like slice syntax
Last modified: 2011-03-15 01:12:56 UTC
Created attachment 179906 [details] [review] valaparser: support for Python-like slice syntax The vala slice syntax is similar to python, but it doesn't allow to use defaults start/stop values like python (i.e.: array[start:], or array[:stop]). This patch fixes it, allowing to use slicing functions like: string word = "Hello World"; print(word[:2]+"\n"); // alias for: print(word[0:2]+"\n"); print(word[2:]+"\n"); // alias for: print(word[2:0]+"\n"); // 0 stands for word.length, see #639586 For strings support it needs the patch which fixes the Bug 639586 For arrays complete support it needs the patch which fixes the Bug 641267
Hi, word[2:] should be an alias for word[2:word.length], otherwise it's not consistent with the first index.
I guess this can be closed, more on bug 571352 *** This bug has been marked as a duplicate of bug 571352 ***