Ad

Our DNA is written in Swift
Jump

Remove Whitespace from NSString

In Cocoa Touch you always need to write more to achieve the same …

NSString *string = @" spaces in front and at the end ";
NSString *trimmedString = [string stringByTrimmingCharactersInSet:
                                  [NSCharacterSet whitespaceAndNewlineCharacterSet]];
NSLog(trimmedString)

While such a standard task might look excessively much code to write, you gain many additional possibilites of what you could want to trim away. NSCharacterSet also knows these other sets. 

  • alphanumericCharacterSet
  • capitalizedLetterCharacterSet
  • controlCharacterSet
  • decimalDigitCharacterSet
  • decomposableCharacterSet
  • illegalCharacterSet
  • letterCharacterSet
  • lowercaseLetterCharacterSet
  • newlineCharacterSet
  • nonBaseCharacterSet
  • punctuationCharacterSet
  • symbolCharacterSet
  • uppercaseLetterCharacterSet
  • whitespaceAndNewlineCharacterSet
  • whitespaceCharacterSet

New Blog started

After blogging for 10 years in German I thought to myself, “Hey. This app development really starts being a serious part of my life. I’d better dedicate a dedicated blog to it!”

Every now and then I would blog programming related topics in a category on my personal blog, but those always felt somewhat misplaced. Then I am frequently discovering new ways how to manage certain tasks in Cocoa Touch, but didn’t have a place to put this new-found knowledge.

Now I do.

All the while I was blogging on my own blogging engine. But software development generally is a TEAM effort. In this case TEAM is a German acronym for  “Toll, ein anderer macht’s” which can be translated as “Great! Somebody else takes care of it!”

I want to concentrate on developing iPhone apps, not coding a blog engine. WordPress to the rescue! This blog was literally running within 5 minutes. And while I was at it, I remembered the suggestion of a BETA tester to find a place where people can submit bugs and suggestions for my apps. My future brother-in-law suggested Mantis and this was also running in only a few minutes. 

The bug reporting site for all my apps is now located at http://www.drobnik.com/bugs