Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
How do I check a text for holding a date value?
isNumber is handy for numbers. Is there anything like that? The scenario I'm looking at is making sure a value in a Seaside control has been entered correctly. |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
On 15.11.2010, at 07:26, Jeff Gray wrote: No, there isn't as far as I know. Checking isNumber is rather easy because you can decide it by looking at a single character. A format like date you have to parse.
You can try to parse the date | date | [ date := DateAndTime fromString: aMightBeADate ] on: Error do: [ :err | ]. After that your date test is isNil. Either you get the parsed date or it is nil if it couldn't parse a date. Norbert _______________________________________________ Pharo-users mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
In reply to this post by Jeff Gray
| amIaDate | [amIaDate asDate] on: Exception do: [:ex | Transcript show: 'That''s not a date, you fool!'] Dan -----Original Message----- From: [hidden email] [mailto:[hidden email]] On Behalf Of Jeff Gray Sent: Monday, November 15, 2010 1:26 To: [hidden email] Subject: [Pharo-users] Check a text - is it a date? How do I check a text for holding a date value? isNumber is handy for numbers. Is there anything like that? The scenario I'm looking at is making sure a value in a Seaside control has been entered correctly. -- View this message in context: http://forum.world.st/Check-a-text-is-it-a-date-tp3042556p3042556.html Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com. _______________________________________________ Pharo-users mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users _______________________________________________ Pharo-users mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
In reply to this post by Jeff Gray
Oops, missed a line :-(
| amIaDate | amIaDate := '30 Feb 2010'. [amIaDate asDate] on: Exception do: [:ex | Transcript show: 'That''s not a date, you fool!'] Dan -----Original Message----- From: [hidden email] [mailto:[hidden email]] On Behalf Of Jeff Gray Sent: Monday, November 15, 2010 1:26 To: [hidden email] Subject: [Pharo-users] Check a text - is it a date? How do I check a text for holding a date value? isNumber is handy for numbers. Is there anything like that? The scenario I'm looking at is making sure a value in a Seaside control has been entered correctly. -- View this message in context: http://forum.world.st/Check-a-text-is-it-a-date-tp3042556p3042556.html Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com. _______________________________________________ Pharo-users mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users _______________________________________________ Pharo-users mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users |
Free forum by Nabble | Edit this page |