Project

General

Profile

Actions

Bug #19739

closed

String coderange not cleared by String#slice!

Added by ilya.andreyuk (Ilya Andreyuk) about 1 year ago. Updated 12 months ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-core:113953]

Description

Hello,
Key cannot be found in a Hash when slice! method is applied to the key. I cannot reproduce this behaviour with sub! or gsub! methods:

hash = {}
key = "ABC OÜ"
key.slice!(/ oü$/i) 
# key.sub!(/ oü$/i, '')
# key.gsub!(/ oü$/i, '')
hash[key] = true
"#{key} in #{hash}: value is #{hash[key]}"

=> "ABC in {\"ABC\"=>true}: value is "

Also it seems that ruby 2.7.6 and 3.2.2 don't have this issue.

Actions

Also available in: Atom PDF

Like0
Like1Like1Like0Like0Like0Like0Like0Like0Like0Like0