i have strings who look like this 20110525 .
how can i make to put '-' caracters in NSString variable ? to let dates look like this 2011-05-25 ? My second question is how can i sort the dat开发者_如何学Goes to make the table look like this 20110525 then 20110526 ?Help please . Thank you
Why not just use the NSDate class to get the date, and use an NSDateFormatter to format the date the way you want.
you can try using sscanf(input,"%4d%2d%2s",&year,&month,&day)
to parse input string and sprintf(output,"%d-%d-%d",year,month,day)
to format your date.
精彩评论