talk-to / Chocolate

Make Cocoa more fun
BSD 3-Clause "New" or "Revised" License
6 stars 1 forks source link

Fix nilling blanks if string has more than one blank #72

Closed anomaly2104 closed 9 years ago

chaitanyagupta commented 9 years ago

I don't think that's the intended purpose of this method. @mx4492 can clarify, but I would suggest creating a new method for this (and its not necessarily required in Chocolate).

mx4492 commented 9 years ago

@chaitanyagupta Yes that was not the intended purpose of the method. It was only required because we used to get both blank strings and missing values in JSON responses from certain API calls (or from the SSC maybe), and this method was useful in normalizing them.

Also, I agree that moving the (modified) method into Chocolate might be premature. @uditiiita You should see if other such use cases arise before reconsidering moving this to Chocolate.

mx4492 commented 9 years ago

However, the current method could certainly be named better. I've opened an issue around this (https://github.com/talk-to/Chocolate/issues/73). @uditiiita If you find your modified method useful after a while also then comment on that issue and we will see which alternative we can use.

anomaly2104 commented 9 years ago

I made this change because in the documentation of "tdt_stringByNillingBlanks", it is written that @returnnilif the receiver is blank, otherwise returns the receiver. I consider both @"" and @" " as blank. May be we should also add one more line of documentation there defining our defining our own meaning of blank for that method.

anomaly2104 commented 9 years ago

Closing this PR!