Get first ten characters in a string
cocoa-touch, nsstring, string
Solution
[@"1234567890" substringToIndex:6]
gives you 123456
- substringFromIndex - from a given index to the end (apple docs )
- substringToIndex - Returns a new string containing the characters of the receiver up to, but not including, the one at a given index (apple docs)
Problem
I'm adding a notepad feature to my application, and I want to read the first ten characters of a string and use that string as the title for a cell in my table view. I think I could use `substringFromIndex:`. Can someone elaborate on how I could go about doing this?