Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: How do I get the Nth character of a string?

by vroom (His Eminence)
on Jan 21, 2000 at 00:56 UTC ( [id://2263]=note: print w/replies, xml ) Need Help??


in reply to How do I get the Nth Character of a String?

Use substr with a length of one. The character numbering is zero based so the first character in the string is the 0th element.
$str = "123456789"; $first = substr($str, 0, 1); #returns the first character $third = substr($str, 2, 1); #returns the third character

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (3)
As of 2024-03-29 06:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found