Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
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 contemplating the Monastery: (8)
As of 2015-07-31 05:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (274 votes), past polls