Project

General

Profile

Actions

Feature #16017

closed

String and Array Slices

Added by D1mon (Dim F) over 3 years ago. Updated over 3 years 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]
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0