Ensure User has entered string in correct format?
Posted
by Daniel Granger
on Stack Overflow
See other posts from Stack Overflow
or by Daniel Granger
Published on 2010-04-24T20:42:56Z
Indexed on
2010/04/24
21:03 UTC
Read the original article
Hit count: 182
Hi,
Whats the best way to ensure the user has entered a valid time string such as:
5:24 5.4
102:30 102.5
It will be entered into a UITextField therefore will be in a NSString.
I want to allow the user to enter the time in either hours and minutes (hh:mm) or hours and decimal minutes (hh.m).
In the hours minutes example they should be able to enter as many hours as the like but only between 0 - 59 minutes. With the hours decimal minutes I want them to only be able to enter again as many hours as the like but decimal minutes can only be 0 - 9.
Many Thanks
© Stack Overflow or respective owner