Project

General

Profile

Actions

Feature #16666

open

'string' - 'str' as a shortcut for 'string'.gsub('str', '')?

Added by vladpisanov (Vlad Pisanov) about 4 years ago. Updated about 4 years ago.

Status:
Open
Assignee:
-
Target version:
-
[ruby-core:97316]

Description

Sorry if this has been brought up before, but I couldn't find anything.

I love how we can substract arrays ([1,2,3] - [1,2]). Does anyone else think the same syntax would be beneficial for Strings?

Some possible scenarios could be:

'string' - 'str'       # Remove substring
'string' - ['s', 't']  # Remove a set of characters
'string' - /^st/       # Remove by regexp
Actions

Also available in: Atom PDF

Like0
Like0Like0