objective c - multiple if condition -


if ( ([mobilenumber.text hasprefix:@"8"] == no)  ||     ([mobilenumber.text hasprefix:@"9"] == no) ) { } 

i wanna test if mobilenumber has prefix of 8 or 9. doing wrong here?

answer: silly me, should , condition instead of or.

should be

if(([mobilenumber.text hasprefix:@"8"] == no) && ([mobilenumber.text hasprefix:@"9"] == no)) {   /* mobile number not have 8 or 9 in beginning */ } 

my comment above make sure there isn't ( in front of mobile number.

edit: did not quite understand after.


Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -