[#66126] Creation/Conversion methods/functions table for Ruby types — SASADA Koichi <ko1@...>
Hi,
5 messages
2014/11/07
[#66248] [ruby-trunk - Feature #10423] [PATCH] opt_str_lit*: avoid literal string allocations — normalperson@...
Issue #10423 has been updated by Eric Wong.
3 messages
2014/11/13
[#66595] [ruby-trunk - Bug #10557] [Open] Block not given when the argument is a string — bartosz@...
Issue #10557 has been reported by Bartosz Kopinski.
3 messages
2014/11/30
[ruby-core:66320] [ruby-trunk - Bug #10518] String "delete" method does not remove some characters from input string
From:
normalperson@...
Date:
2014-11-16 12:18:25 UTC
List:
ruby-core #66320
Issue #10518 has been updated by Eric Wong. sergio.gallelli@gmail.com wrote: > irb(main):001:0> str = 'A-B' > => "A-B" > irb(main):002:0> str.delete ' -#' > => "A-B" ' -#' is interpreted as: range of characters from ' ' (space) to '#'. See String#count documentation I suppose it is weird and surprising behavior, but I doubt it can change for compatibility. I would normally use String#tr if I wanted a range. ---------------------------------------- Bug #10518: String "delete" method does not remove some characters from input string https://bugs.ruby-lang.org/issues/10518#change-49979 * Author: Sergio Gallelli * Status: Open * Priority: Normal * Assignee: * Category: * Target version: * ruby -v: ruby 2.1.4p265 (2014-10-27 revision 48166) [i386-mingw32] * Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN ---------------------------------------- This bug affects all Ruby versions I tried, i.e. 2.0.0 and 2.1.4 on Windows and 2.1.5 on Linux In some cases the String "delete" method does not remove all the characters from the input string I ask for removal. The problem seems to depend on the string passed as argument to the delete method and on the order of its characters. Please take a look at the simple "irb" dump below: irb(main):001:0> str = 'A-B' => "A-B" irb(main):002:0> str.delete ' -#' => "A-B" irb(main):003:0> str.delete ' #-' => "AB" If I try to remove the dash from string 'A-B' passing ' -#' to the delete method, it does not work. If I change the order of the characters passed to the delete method, the result is correct. The attached Ruby program shows the above problem. ---Files-------------------------------- str_delete_bug.rb (59 Bytes) -- https://bugs.ruby-lang.org/