>>>>> "NT" == Nathan Torkington <[EMAIL PROTECTED]> writes:
NT> Chaim Frenkel writes:
>> Somehow I find
>> if (40 == ($foo = substr($bar, index($bar, 'xyz')))) {
>> }
NT> I don't understand your hypothetical code. substr() returns the
NT> substring of $bar from the position retutned by index, onward.
NT> When would this be 40, if index is going to return the position
NT> of 'xyz'?
NT> I guess I can't understand your idea of safe failure until I
NT> see an example, and this doesn't seem to be it.
Whoops, I was tired.
$to = "010 020 030 047";
$from="AAA BBB CCC DDD";
print substr($to,index($from,"BBB"),3);
print substr($to,index($from,"XXX"),3);
__END__
020
7
I would like to have an undef returned.
(Now it would have been interesting if it returned "047", then having
index return an undef and then having substr() propgate the undef
would make things workable.)
If you are familiar with Sybase's version of sql. Invalid arguments
to various functions return NULL.
<chaim>
--
Chaim Frenkel Nonlinear Knowledge, Inc.
[EMAIL PROTECTED] +1-718-236-0183
- RFC 213 (v1) rindex and index should return undef on f... Perl6 RFC Librarian
- Re: RFC 213 (v1) rindex and index should return u... Tom Christiansen
- Re: RFC 213 (v1) rindex and index should retu... Nathan Wiger
- Re: RFC 213 (v1) rindex and index should return u... Chaim Frenkel
- Re: RFC 213 (v1) rindex and index should retu... Nathan Torkington
- Re: RFC 213 (v1) rindex and index should ... Chaim Frenkel
- Re: RFC 213 (v1) rindex and index sho... Nathan Torkington
- Re: RFC 213 (v1) rindex and inde... Chaim Frenkel
- Re: RFC 213 (v1) rindex and ... Nathan Torkington
- Re: RFC 213 (v1) rindex ... Chaim Frenkel
- Re: RFC 213 (v1) rindex ... Glenn Linderman
- Re: RFC 213 (v1) rindex ... John Porter
- Re: RFC 213 (v1) rindex ... Chaim Frenkel
- Re: RFC 213 (v1) rindex ... Glenn Linderman
- Re: RFC 213 (v1) rindex and index should retu... John Porter
- Re: RFC 213 (v1) rindex and index should ... Glenn Linderman
- Re: RFC 213 (v1) rindex and index sho... Chaim Frenkel
- Re: RFC 213 (v1) rindex and inde... Glenn Linderman
