From: Sean Chittenden Date: 2001-08-14T16:35:55+09:00 Subject: [ruby-talk:19684] Re: String#substr ? --Kj7319i9nmIyA2yE Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Blah. This message had been stuck in my mail queue since=20 Sunday, sorry about the duplicate post. -sc > Perl/C/PHP have substr.... does the ruby equiv exist outside of > the use of regexp's? Used with String#index, I'd think this method > would be really useful. It surprises me that I haven't seen it > referenced/used anywhere and that's actually half of why I'm asking: did > I miss this functionality someplace under a different name? I don't > think so, but I'm not 100% sure. How have other people dealt w/ this? = =20 > Is there an external module that implements this functionality > someplace? Are there plans to include it in 1.7? -sc >=20 >=20 > Taken from perldoc -tf substr: > substr EXPR,OFFSET,LEN,REPLACEMENT > substr EXPR,OFFSET,LEN > substr EXPR,OFFSET > Extracts a substring out of EXPR and returns it. First > character is at offset `0', or whatever you've set `$[' > to (but don't do that). If OFFSET is negative (or more > precisely, less than `$['), starts that far from the end > of the string. If LEN is omitted, returns everything to > the end of the string. If LEN is negative, leaves that > many characters off the end of the string. --=20 Sean Chittenden --Kj7319i9nmIyA2yE Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Comment: Sean Chittenden iEYEARECAAYFAjt41NcACgkQn09c7x7d+q2QBQCfbAsmN2qigTounrugeJpye4Dn x5sAoJ/dpvvQYHaj8wHTbS9KijNtzApu =TLao -----END PGP SIGNATURE----- --Kj7319i9nmIyA2yE--