Blog Stats
  • Posts - 144
  • Articles - 0
  • Comments - 36
  • Trackbacks - 0

 

String Practice

Now this might be sacrilege to some,  and a blessing to others.

Through using Objective C,   I realise that I really miss the ability to do C# quick and easy string manipulation, like -

IndexOf
Trim
Replace
Substring
Split
etc.

For my own sake,  I’ve begun working on some functional equivalents.

So far I’ve got

 

- (NSInteger) LastIndexOf:(NSString *)searchstring;

- (NSInteger) LastIndexOfI:(NSString *)searchstring;

- (NSInteger) IndexOf:(NSString *)searchstring;

- (NSInteger) IndexOfI:(NSString *)searchstring;

- (NSString *) PadLeft:(NSInteger)totallength;

- (NSString *) PadRight:(NSInteger)totallength;

- (NSString *) Remove:(NSString *)what;

- (NSString *) RemoveI:(NSString *)what;

- (NSString *) Replace:(NSString *)what with:(NSString *)with;

- (NSString *) ReplaceI:(NSString *)what with:(NSString *)with;

- (NSString *) SubString:(NSInteger)start;

- (NSString *) SubString:(NSInteger)start length:(NSInteger)length;

- (NSString *) Trim;

- (NSString *) LTrim;

- (NSString *) RTrim;

- (NSArray *) Split:(NSString *)

Full source available here -

 

Or if link doesn't work Click Contact Me, and I'll send you a copy


Feedback

No comments posted yet.


Post A Comment
Title:
Name:
Email:
Comment:
Verification:
 
 

 

 

Copyright © Richard Jones