Often, after the user has edited a bunch of text fields, just before saving i want to trim the whitespace, because its all too common for the user to leave a space at the start or end of a 'username' or other important field.

So here's a chunk of code, put it in your view controller, and it'll trim all your text fields. Its worth looking at just to see how verbose the obj-c equivalent of .Trim() is!

Thanks for reading! And if you want to get in touch, I'd love to hear from you: chris.hulbert at gmail.

Chris Hulbert

(Comp Sci, Hons - UTS)

iOS Developer in Sydney.

I have worked at places such as Google, Cochlear, News Corp, Fox Sports, NineMSN, FetchTV, Woolworths, and Westpac, among others. If you're looking for a good iOS developer, drop me a line!

Get in touch:
[email protected]
my resume

 Subscribe via RSS