i have two variable string both have same time like a= 4:15 PM and b = 4:15 PM i am trying to compare these two variables in if to perform a specific task but it always returns false is there any solution?
Asked
Active
Viewed 64 times
0
-
3Provide code what you had implemented – Jaydeep Vora Jul 04 '18 at 11:57
-
Try using a breakpoint at the location of comparison and print the values of the 2 variables and check if there is an extra space or something like that. If they are exactly the same and you are comparing them using '==', it should return true. Most of the time there might be whitespaces extra somewhere if it returns false. – Rakesha Shastri Jul 04 '18 at 12:00
1 Answers
1
It would be easier to help if you provided some of the code you are having problems with. If you are absolutely certain both strings have the same exact sequence of characters it should be as simple as comparing them with a == b. You could try using breakpoints in xcode to check the state of the variables before they are compared.

Breiby
- 554
- 5
- 14