Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: How do I get the Nth Character of a String?

by PetaMem (Priest)
on Sep 14, 2009 at 13:42 UTC ( [id://795133]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
         split: 17 wallclock secs (16.69 usr +  0.02 sys = 16.71 CPU) @ 59
    +844.40/s (n=1000000)
        substr:  0 wallclock secs ( 0.74 usr +  0.00 sys =  0.74 CPU) @ 13
    +51351.35/s (n=1000000)
        unpack:  1 wallclock secs ( 1.02 usr +  0.00 sys =  1.02 CPU) @ 98
    +0392.16/s (n=1000000)
    
  2. or download this
         split:  2 wallclock secs ( 1.16 usr +  0.00 sys =  1.16 CPU) @ 86
    +2068.97/s (n=1000000)
        substr:  1 wallclock secs ( 0.70 usr +  0.00 sys =  0.70 CPU) @ 14
    +28571.43/s (n=1000000)
        unpack:  0 wallclock secs ( 0.96 usr +  0.00 sys =  0.96 CPU) @ 10
    +41666.67/s (n=1000000)
    
  3. or download this
    #!/usr/bin/perl -w
    use strict;
    ...
    sub getn_split {
        return +(split //, $_[0],2)[$_[1]-1];
    }
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (7)
As of 2024-04-19 08:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found