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

Re: oneliner to count the number binary digits in this string 1011111

by BillKSmith (Monsignor)
on Mar 13, 2021 at 16:31 UTC ( #11129576=note: print w/replies, xml ) Need Help??


in reply to oneliner to count the number binary digits in this string 1011111

If you know that the string contains only binary digits, use length('1011111'). Use LanX's method if you wish to ignore non-binary characters.
Bill
  • Comment on Re: oneliner to count the number binary digits in this string 1011111
  • Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (4)
As of 2022-05-29 09:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (101 votes). Check out past polls.

    Notices?