Actions
Bug #19087
closedString#to_c supports multiple "_"
Bug #19087:
String#to_c supports multiple "_"
Description
I've noticed a minor inconsistent behaviour of String#to_c method. It does not treat a sequence of _ character as an end of meaningful characters:
"123".to_c # => (123+0i)
"12_3".to_c # => (123+0i)
"12__3".to_c # => (123+0i)
"12___3".to_c # => (123+0i)
Similar methods #to_i and #to_r treat multiple _ in a different way - they just ignore characters after it:
I would expect #to_c to behave similarly.
Actions