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

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

android - Keyboard hides my half of edit-text and button below it even in scroll view -