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

(dkubb) Re: (3) Answer: How do I replace a substring (if exists) with a different substring in a string?

by dkubb (Deacon)
on Jul 22, 2001 at 02:00 UTC ( [id://98706]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
      my $string  = '01234567890';
      my $find    = '0';
      my $replace = 'a';  
    ...
        substr($string, $pos, length($find), $replace);
        $pos = index($string, $find, $pos + length($replace));
      }
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://98706]
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-04-25 22:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found