Quickies for NSString
Just for giggles, a few comparisons:
‘join’ an array of strings into a single string [permalink]
Ruby: str = chunks.join(” :-) “)
‘split’ a string into an array
Ruby: array = string.split(‘:’)
Converting string to an integer
Ruby: “123”.to_i
Iterating attributes in an attributed string
Ruby: ??? no idea. Completely lost as to what they’re doing. It’s really late.
Making localizable strings
Ruby: Install gibberish? ;-)
Stripping out newlines from a string
Ruby: ” str “.strip
Today’s date as a string
Ruby: Date.today.to_s
Sure, it’s an incredibly powerful language, but at the same time I’m consistently reminded of why I love ruby.