From: Sean Chittenden Date: 2001-08-14T16:31:12+09:00 Subject: [ruby-talk:19683] String#substr ? 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? Is there an external module that implements this functionality someplace? Are there plans to include it in 1.7? -sc 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. -- Sean Chittenden