How do you convert Binary String to it’s Integer Value? There are many approaches to convert Binary strings to Integers. One approach could be to iterate through all of the characters in the string and add the value of 2 raised to the power of the index.
Category Archives: Basics
Heads or Tails – Using and understanding Swift
It would be nearly a year since Swift was announced by Apple. It soon became the language of choice for many developers. It is one of the fastest adopted programming language till date. Not only that, it also has one of the largest repository of source code using Swift. Here’s a look at both sides […]
You’re My Favorite Waste of Time
This song from Paul Owens released somewhere around 1986 summarizes very well what Swift means to a lot of developers today. This is a subtle way of suggesting that Swift in it’s evolutionary phase is a bit difficult to work with. It would still be fine if the updates and changes were a year down […]
One way to use enums – just another day with Swift
Swift is quite interesting and is changing the way you would develop in the future. For this article, let’s look at using enums in an interesting manner.
My Wishlist for Playgrounds
Apple Playgrounds are amazing and for those that are using it know how it works best for them. Some use it for algorithms, some for testing code, etc. One of the reasons that I think playgrounds is important is the integration. The integration of commentary and code that make it seem more like an interactive […]
WIP: Use Swift Arrays like Lua Tables
This is work in progress and there are somethings that Swift cannot do where as Lua excels with them. Since everything in a Lua table is a reference or a pointer, you can recursively add table to refer to subtables. You could also store functions in the tables and invoke them based on the key. […]
Tip: Creating an Int from a String in Swift
Talking to a couple of developers over various mediums about Swift has had mixed results. However one thing that came up again and again was that it is a little confusing. While confusing in the literal sense would not be the correct word. So let me elaborate the issue first.
Using a cout << like function with Swift to work with console and String
If you have worked with C++, you might be well aware of the cout function, it is one of the most commonly used functions with C++. That is simply because you can just use it so // cout << “Hello World” and it prints Hello World to the console. Well, using the println(“Hello World”) is […]
Tuples – holding multiple values in a variable
We saw that we can declare variables or constants to hold values that we could use in our code instead of hard-coding them. We could also return values from functions however in most languages you can only return a single value. Mainly this return value would be more like a Boolean value that indicated if […]