diff options
author | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-07-05 21:50:13 +0000 |
---|---|---|
committer | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-07-05 21:50:13 +0000 |
commit | cd0971e27f8da253918374e38c329fe709eed429 (patch) | |
tree | 933d802b5b59475290e54ee297106c6480669772 /string.c | |
parent | 9360721e5880fdeff4e72495991b3ffc8d94b190 (diff) | |
download | ruby-cd0971e27f8da253918374e38c329fe709eed429.tar.gz |
* array.c (rb_ary_aref): Added a description of the behavior of
index positioning. [Bug #6680]
* array.c (rb_ary_aset): ditto. Reordered sentences for clarity.
* string.c (rb_str_aref_m): Added a description of the behavior of
index positioning
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36328 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'string.c')
-rw-r--r-- | string.c | 11 |
1 files changed, 8 insertions, 3 deletions
@@ -3223,9 +3223,14 @@ rb_str_aref(VALUE str, VALUE indx) * Element Reference --- If passed a single +index+, returns a substring of * one character at that index. If passed a +start+ index and a +length+, * returns a substring containing +length+ characters starting at the - * +index+. If passed a range, its beginning and end are interpreted as - * offsets delimiting the substring to be returned. In these three cases, if - * an index is negative, it is counted from the end of the string. + * +index+. If passed a +range+, its beginning and end are interpreted as + * offsets delimiting the substring to be returned. + * + * In these three cases, if an index is negative, it is counted from the end + * of the string. For the +start+ and +range+ cases the starting index + * is just before a character and an index matching the string's size. + * Additionally, an empty string is returned when the starting index for a + * character range is at the end of the string. * * Returns +nil+ if the initial index falls outside the string or the length * is negative. |