1. ## ctod()

What do you conclude from the following?

dim a as c
a="The time has come for all men"

?ctod(a)
= { / / }

a="04 06 2007 The time has come for all men"
?ctod(a)
= {04/06/2007}

a="4cows 2hens 3bushels The time has come for all men"
?ctod(a)
= {04/02/2003}

a=" 5abcde2fghij3456klm"
?ctod(a)
= {05/02/3456}

a=" 5abcde2fghij345klm"
?ctod(a)
= {05/02/0345}

a="12 12 2007"
?ctod(a)
= {12/12/2007}

a="1212 2007"
?ctod(a)
= { / / }
= {12/12/0200}

a="4dogs 3cats"
?b
= "4d/og/s 3c"

?ctod(b)
= {04/03/2007}

2. ## Re: ctod()

that you should feed it valid data!!

3. ## Re: ctod()

You don't know what date it is.

Sorry, couldn't resist.:)

4. ## Re: ctod()

that you should feed it valid data!!
Very true.. BUT, what do you make of this:
a="4cows 2hens 3bushels The time has come for all men"
?ctod(a)
= {04/02/2003}

or this:

a="4dogs 3cats"
?b
= "4d/og/s 3c"

?ctod(b)
= {04/03/2007}

5. ## Re: ctod()

Gabriel,
Until the last three, it seemed that a character 1-9 was treated as its val() number but all else treated as '0' until the inherent place (d,m,y) mask was filled, then ignored the remainder until a real number could be achieved to start the next mask place. D and M evaluated 2 serially 2 at a time, y 4 at a time.

a=" 5abcde2fghij345klm"

5a = 50.... not acceptable therefore first place = 05
ab = 00.... not acceptable
bc = 00.... not acceptable
cd = 00.... not acceptable
de =00.... not acceptable
e2 = 02....acceptable............. M value = 02
fghi = 0000........... not acceptable
ghij = 0000 .... not acceptable
hij3 = 0003 ... not acceptable
ij34 = 0034 .... not acceptable
jk3lm = 0345.... possibly acceptable ............ Y value = 0345...test next
345m = 3450...... not acceptable, so use prior. Complete

?ctod(a)
= {05/02/0345}

It works for most, but I'm not sseeing it does for the last 3.

6. ## Re: ctod()

yeh..it appears that alpha scans the string from the left looking for any numerals, which it then evaluates to numeric, the first numeric will be for the month, the second for the day and the third (if any) for the year.

From this testing, you see that you could feed ctod() garbage, and it might give you a valid date instead of an error message!

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•