Project

General

Profile

Bug #6680 ยป rdoc_for_array_and_string_slice.patch

stomar (Marcus Stollsteimer), 07/01/2012 07:27 AM

View differences:

array.c (Arbeitskopie)
1015 1015
 *  or returns a subarray starting at +start+ and
1016 1016
 *  continuing for +length+ elements, or returns a subarray
1017 1017
 *  specified by +range+.
1018
 *  In the latter two cases, the start value identifies the place
1019
 *  just before an element.
1018 1020
 *  Negative indices count backward from the end of the
1019 1021
 *  array (-1 is the last element). Returns +nil+ if the index
1020 1022
 *  (or starting index) are out of range.
......
1029 1031
 *     a[-3, 3]               #=> [ "c", "d", "e" ]
1030 1032
 *     # special cases
1031 1033
 *     a[5]                   #=> nil
1034
 *     a[6, 1]                #=> nil
1032 1035
 *     a[5, 1]                #=> []
1033 1036
 *     a[5..10]               #=> []
1034 1037
 *
......
1432 1435
 *  Element Assignment --- Sets the element at +index+, or replaces a subarray
1433 1436
 *  from +start+ for +length+ elements, or replaces a subarray specified by
1434 1437
 *  +range+.
1438
 *  In the latter two cases, the start value identifies the place
1439
 *  just before an element.
1435 1440
 *
1436 1441
 *  If indices are greater than the current capacity of the array, the array
1437 1442
 *  grows automatically. Negative indices will count backward from the end of
......
1451 1456
 *     a[-1]   = "Z"               #=> ["A", "Z"]
1452 1457
 *     a[1..-1] = nil              #=> ["A", nil]
1453 1458
 *     a[1..-1] = []               #=> ["A"]
1459
 *     a[0, 0] = [ 1, 2 ]          #=> [1, 2, "A"]
1460
 *     a[3, 0] = "B"               #=> [1, 2, "A", "B"]
1454 1461
 */
1455 1462

  
1456 1463
static VALUE
string.c (Arbeitskopie)
3220 3220
 *  substring of one character at that position. If passed two <code>Fixnum</code>
3221 3221
 *  objects, returns a substring starting at the offset given by the first, and
3222 3222
 *  with a length given by the second. If passed a range, its beginning and end
3223
 *  are interpreted as offsets delimiting the substring to be returned. In all
3224
 *  three cases, if an offset is negative, it is counted from the end of <i>str</i>.
3223
 *  are interpreted as offsets delimiting the substring to be returned.
3224
 *  In the latter two cases, the offset identifies the place just before a substring.
3225
 *  In all three cases, if an offset is negative, it is counted from the end
3226
 *  of <i>str</i>.
3225 3227
 *  Returns <code>nil</code> if the initial offset falls outside the string or
3226 3228
 *  the length is negative.
3227 3229
 *
......
3240 3242
 *     a[7..-2]               #=> "her"
3241 3243
 *     a[-4..-2]              #=> "her"
3242 3244
 *     a[-2..-4]              #=> ""
3245
 *     a[11, 0]               #=> ""
3246
 *     a[11]                  #=> nil
3247
 *     a[12, 0]               #=> nil
3243 3248
 *     a[12..-1]              #=> nil
3244 3249
 *     a[/[aeiou](.)\1/]      #=> "ell"
3245 3250
 *     a[/[aeiou](.)\1/, 0]   #=> "ell"