Showing posts with label substring. Show all posts
Showing posts with label substring. Show all posts

Friday, June 1, 2012

String contains string in objective-c


How can I check if a string (NSString) contains another smaller string? I was hoping for something like:

Friday, May 18, 2012

If strings are immutable in .NET, then why does Substring take O(n) time?


Given that strings are immutable in .NET, I'm wondering why they have been designed such that string.Substring() takes O( substring.Length ) time, instead of O(1)?