Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.ruby
String#slice! doc bug?
Daniel Berger
12/20/2006 3:42:00 AM
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi all,
Ruby 1.8.4 and 1.8.5
The docs for String#slice! say, "The forms that take a Fixnum will raise
an IndexError if the value is out of range."
However, I cannot duplicate this behavior. Whenever I try to force an
IndexError, I just get back nil, i.e. the same behavior as String.slice.
irb(main):001:0> VERSION
=> "1.8.4"
irb(main):002:0> s = "hello"
=> "hello"
irb(main):003:0> s.slice!(-5,-99)
=> nil
irb(main):004:0> s
=> "hello"
irb(main):005:0> s.slice!(-5,100)
=> "hello"
irb(main):006:0> s
=> ""
I tried a few other things with no luck. Am I missing the proper test case?
Thanks,
Dan
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Using GnuPG with SUSE -
http://enigmail....
iD8DBQFFiLDq3p/dorzCFX0RAtzeAJ9M8622KzUTHfeiwAQPdjcthjmrMACeO3qk
v/9pNgyUiGziHHgi1Vlht9w=
=lGlO
-----END PGP SIGNATURE-----
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
String#slice! doc bug?
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password