[Newbies] Efficient date parsing

goran at krampe.se goran at krampe.se
Thu Apr 3 13:50:43 UTC 2008


Hi!

I tried downloading my original attachment and the problem is that it
was/is double-gzipped - not sure why. Anyway, attaching once more the
ChangeSet. It installs fine in 3.10beta7159 at least.

You install it by decompressing it and then use the "install" button in
the filelist, or by just using "filein" on the compressed file directly
(not sure why there is no install button in that case but anyway).

I also include the method comment below to show you what it gives you:

readFrom: inputStream pattern: pattern
	"Read a Date from the stream based on the pattern which can include the
tokens:
	
		y = A year with 1-n digits
		yy = A year with 2 digits
		yyyy = A year with 4 digits
		m = A month with 1-n digits
		mm = A month with 2 digits
		d = A day with 1-n digits
		dd = A day with 2 digits
		
	...and any other Strings inbetween. Representing $y, $m and $d is done
using
	\y, \m and \d and slash itself with \\. Simple example patterns:

		'yyyy-mm-dd'
		'yyyymmdd'
		'yy.mm.dd'
		'ymd'

	A year given using only two decimals is considered to be >2000."



regards, Göran
-------------- next part --------------
A non-text attachment was scrubbed...
Name: DateReadFromPattern.cs.gz
Type: application/octet-stream
Size: 1011 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/beginners/attachments/20080403/95ca41ee/DateReadFromPattern.cs.obj


More information about the Beginners mailing list