Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Check if one string is a substring of another.

by mk. (Friar)
on Feb 14, 2006 at 11:36 UTC ( [id://530097]=note: print w/replies, xml ) Need Help??


in reply to Check if one string is a substring of another.

perl -e '$s1="foofoo";$s2="foo";(length$s1<length$s2)?$check=index$s2,$s1:$check=index$s1,$s2;print "match\n" if $check>=0'


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (None)
    As of 2024-04-19 00:00 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      No recent polls found