Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: substring exists at particular postion?

by demerphq (Chancellor)
on May 23, 2002 at 12:42 UTC ( [id://168751]=note: print w/replies, xml ) Need Help??


in reply to substring exists at particular postion?

Well index() will certainly do what you want. (If you have really long strings then substr() probably would be faster. But im just guessing)
my $str="0123456Foo012345"; my $pos=7; my $srch="Foo"; print "Its there all right!" if index($str,$srch,$pos)==$pos;
HTH

Yves / DeMerphq
---
Writing a good benchmark isnt as easy as it might look.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://168751]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (4)
As of 2025-05-23 17:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.