Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
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 having an uproarious good time at the Monastery: (2)
As of 2024-05-25 07:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found