Often in our projects we need to apply some kind of validation of the user input so we get the data we are expecting. For example, getting a valid email addresses or URL. I want to share with you a couple of String Class extensions you can use to see (and conform) whether the user typed a valid email or URL, this is not a silver bullet (there are always exceptions), but it can save you some time now and in future projects.
In this Xojo tutorial we will see how simple it is to make an iOS App that shortens an entered URL using the public API of Bit.ly. We will use our own subclass inherited from Xojo.Net.HTTPSocket, and the Declare statement in order to use some functions and methods found on the native Cocoa Touch API. In fact, the use of Declare is mandatory because with the new Xojo Framewok we don’t yet have access to the EncodeURLComponent function available with the old framework. This one is a big help in substituting any ilegal character with his hexadecimal value for the final URL’s composition.