From: Sean Chittenden Date: 2001-08-14T05:10:28+09:00 Subject: [ruby-talk:19652] 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 PS Is anyone else noticing any problems when trying to send email to the list? It looks like a DNS timeout on resolving host names, but this is the only list that I seem to be having problems with (on about 40-50 other lists w/o issue). 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 __________________________________________________ Do You Yahoo!? Send instant messages & get email alerts with Yahoo! Messenger. http://im.yahoo.com/