Project

General

Profile

Actions

Feature #16017

closed

String and Array Slices

Added by D1mon (Dim F) almost 5 years ago. Updated almost 5 years ago.

Status:
Feedback
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]
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0