Re: problem

new topic     » goto parent     » topic index » view thread      » older message » newer message

On Sun, 12 Oct 2003 10:21:41 -0400, George Walters
<gwalters at sc.rr.com> wrote:

>I'm trying to write a functon  to convert a sequence (of numbers and
>strings) to a long string sequence.
>i.e {1,2,{2002,12,30}} to "(1,2,"2002-12-30")"
>
>the problem is to distinguish between the string "123" and the sequence
>{1,2,3}.
>they both have a length of 3 and all their elements are atoms.

George,
I had a little play with one of my routines so it now handles the
above pretty well. As for the dates, I went with:

		-- date handling added for George Walters 12/10/2003
		if length(ppp_Date) and length(cl)=3D3=20
		and integer(cl[1]) and integer(cl[2]) and integer(cl[3])
		and ((cl[1]>=3D1 and cl[1]<=3D31 and cl[3]>=3D1900 and cl[3]<=3D3000)
		 or  (cl[3]>=3D1 and cl[3]<=3D31 and cl[1]>=3D1900 and cl[1]<=3D3000))
		and (cl[2]>=3D1 and cl[2]<=3D12) then
			if prnt then sput('\"'&sprintf(ppp_Date,cl)&'\"') end if

However, I'm having a little trouble uploading things at the moment,
so it will be a few days before I can let you have a play with it, if
you can wait. I'll let you know when it's up.

Meantime, I suspect there are many other conditions you'd like covered
(text strings and floats to name two), if you post a few more examples
then I'll write a test program so you can better see how to use it.

Regards,
Pete

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu