How to write "decToBin" in Swift? -


i have been looking equivalent javascripts dectobin in swift 2. have not been able find anything. replicate following javascript code code:

var max = 511; var maxlength = dectobin(max).tostring().length; 

you can use string achieve this:

let max       = 511 let maxlength = string(max, radix: 2).characters.count 

you can find more in apple string documentation


Comments

Popular posts from this blog

c - How to retrieve a variable from the Apache configuration inside the module? -

c# - Constructor arguments cannot be passed for interface mocks -

python - malformed header from script index.py Bad header -