[Solved] What are some different ways of making an effective email validation method without using regular expression in objective c?

my attempt @interface Tester : NSObject +(BOOL) testForValidMail:(NSString *)mail; @end @implementation Tester +(BOOL)testForValidMail:(NSString *)string { NSRange atRange = [string rangeOfString:@”@”]; BOOL b = NO; if ((atRange.location != NSNotFound) //is `@` present && (atRange.location != 0) // and is `@` not at the beginning -> left substring exist && (atRange.location != string.length-1) // and not at … Read more

[Solved] How to convert an NSString to id or UIView objective-c iphone [closed]

This gets you a UIViewController loaded from a xib. Class vcClass = NSClassFromString (@”myUIView”); UIViewController *detailViewController = [[vcClass alloc] initWithNibName:@”myUIView” bundle:nil]; If you just wanted a UIView object, just do: UIView* myView = [[vcClass alloc] init]; But really, as the three answers so far show it isn’t clear at all what you what. Can you … Read more

[Solved] Can’t set cell title’s text

Since you declared title and text as properties, but for some reason get the exception: [Notez setTitle:]: unrecognized selector sent to instance, apparently I can only make another guess here. Usually, when declaring a property, you get a setter and a getter method for it. This way you can omit writing these by hand if … Read more

[Solved] Remove a character once

I don’t know I understand exactly what you want to do but from your example you mast want to remove last come. If there is always closing bracket ‘]’ at the end you can use; str = [str stringByReplacingOccurrencesOfString:@” ,]” withString:@”]”]; Hope this is what you are after. solved Remove a character once

[Solved] Literal converstion NSData to NSString [closed]

HINT#1 //general answer NSString provides an initializer for this purpose. You can see more info using the docs here. NSString * str = [[NSString alloc] initWithData: mynsdata encoding:NSUTF8StringEncoding]; Assuming you use ARC. HINT#2 // the answer for hex nsdata int len = [mynsdata length]; NSMutableString *str = [NSMutableString stringWithCapacity:len*2]; const unsigned char *nsdata_bytes = [mynsdata … Read more

[Solved] How to spliit a NSString in iOS [duplicate]

you can do this multiple types assume that this is your String NSString *origialString [email protected]”00:03:45″; Type-1 NSArray *getBalance = [origialString componentsSeparatedByString: @”:”]; origialString = [NSString stringWithFormat:@”%@:%@”, [getBalance objectAtIndex:1], [getBalance objectAtIndex:2]]; Type-2 origialString = [origialString substringFromIndex:3]; Type-3 origialString = [origialString substringWithRange:NSMakeRange(3, [origialString length]-3)]; Type-4 // Use NSDateformatter but not necessary for here solved How to spliit … Read more