Project

General

Profile

Feature #16017

String and Array Slices

Added by D1mon (Dim F) about 1 year ago. Updated about 1 year ago.

Status:
Feedback
Priority:
Normal
Assignee:
-
Target version:
-
[ruby-core:93893]

Description

Recently began to study Ruby and lacks some things from the python. I wish they were added to Ruby.

"hello, world!"[3:9:2]
# 'l,w'
"hello, world!"[3:9]
# 'lo, wo'
[1,2,3,4,5][1:3]
# [2, 3]
[1,2,3,4,5][1:5:2]
# [2, 4]

Also available in: Atom PDF