generics - Generate an integer binary representation using Swift? -


How to create a function of accepting any kind of int or UIT in swift (and about the type of bits

Pre> init & lt; T: _SignedIntegerType & gt; (_ V: T, radix: int, uppercase: boole = default) init & lt; T: _UnsignedIntegerType & gt; (_ V: T, radix: int, uppercase: boole = default)

which can be used here:

  num = 100 commands Give string (num, radix: 2) print (str) // output: 1100100  

Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

java - Gradle dependencies: compile project by relative path -

ruby on rails - Object doesn't support #inspect when used with .include -