Substrings from NSString :: N-FAQ

Hello iOS geeks …
Here is a small tip for getting a substring from NSString;
NSString class provide the following methods for splitting a string;
– (NSString *)substringFromIndex:(NSUInteger)from;
– (NSString *)substringToIndex:(NSUInteger)to;
– (NSString *)substringWithRange:(NSRange)range;
– (NSRange)rangeOfString:(NSString *)<em>aString;
The following code will demonstrate itself;
NSString testString = @”I love programming in objective-c”;
[testString substringToIndex:5]; // will return I Love
[testString substringFromIndex:7]; // will return pogramming in objective-c
[testString substringWithRange:NSMakeRange(21, 32)]; // will return objective-c
Use this method to check whether the giving string present in the target string or not.
[testString rangeOfString:@”love”]; // Will return an NSRange structure giving the location and length in the receiver of the first occurrence of aString. Returns ]{NSNotFound, 0} if =aString is not found or is empty (@””).
[/sourcecode]
I think self-descriptive code chunk, so no need to write anything more; (:
Happy Development;
This post belongs to N-FAQ category where i post anything i learn new (no matter how it small or big) during my work; N-FAQ = Not-FAQ;
What’s up, just wanted to tell you, I loved this article.
It was inspiring. Keep on posting!
WOW just what I was searching for. Came here by searching for website
Hmm is anyone else experiencing problems with the images on this
blog loading? I’m trying to figure out if its a problem on my end or if it’s
the blog. Any feed-back would be greatly appreciated.
Hey just wanted to give you a quick heads up.
The text in your post seem to be running off the screen in Safari.
I’m not sure if this is a formatting issue or something to do with internet browser
compatibility but I figured I’d post to let you know.
The style and design look great though! Hope you get the issue solved soon. Kudos
Hello there! I simply want to give you a big thumbs up for the excellent information you’ve got here on this post.
I am coming back to your web site for more soon.
my web-site … OracleLeaf CBD
When someone writes an post he/she retains the
idea of a user in his/her brain that how a user can understand it.
Thus that’s why this article is outstdanding. Thanks!
My webpage … Mack And Sons CBD
Sweet internet site, super design and style,
very clean and utilize genial.
Also visit my web-site; tct.info.vn
Hey there! I’m at work browsing your blog from my new iphone 4!
Just wanted to say I love reading through your blog and look forward to all
your posts! Keep up the outstanding work!
Here is my site; Xtreme Shred Keto Review
For newest information you have to visit internet and on internet I found this
web site as a best site for latest updates.
Also visit my site; Syner Sooth CBD Review
I am sure this paragraph has touched all the internet people, its really really good paragraph on building up new weblog.
Also visit my webpage kerry96x6737.shop1.cz
Very interesting topic, regards for putting up.
Feel free to visit my webpage: Leafy CBD