Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Detecting whether forward slash is present in string

by zdog (Priest)
on Sep 13, 2004 at 21:54 UTC ( #390675=note: print w/ replies, xml ) Need Help??


in reply to Detecting whether forward slash is present in string

Good ol' substitution regex:

# if ( substr( $string1, -1, 1 ) eq "/" ) # check for trailing slash. if ( $string1 =~ s|/\s*$|/| ) # even better { $string2 =~ s|^/||; # remove leading slash if it's present. }

Update: Added additional code to satisfy problem requirements more fully.

Zenon Zabinski | zdog | zdog@perlmonk.org


Comment on Re: Detecting whether forward slash is present in string
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (7)
As of 2014-08-30 02:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (291 votes), past polls