Alpha Video Training
Results 1 to 6 of 6

Thread: ctod()

  1. #1
    "Certified" Alphaholic G Gabriel's Avatar
    Real Name
    G. Gabriel
    Join Date
    Oct 2004
    Posts
    7,204

    Default 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)
    = { / / }
    ?ctod(mask(a," / / "))
    = {12/12/0200}

    a="4dogs 3cats"
    b=mask(a," / / ")
    ?b
    = "4d/og/s 3c"

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

  2. #2
    VAR
    Real Name
    Martin W. Cole
    Join Date
    Apr 2000
    Location
    Terrell, Texas (near Dallas)
    Posts
    5,957

    Default Re: ctod()

    that you should feed it valid data!!
    Cole Custom Programming - Terrell, Texas
    972 524 8714
    martin_w_cole@msn.com

    ____________________
    "A young man who is not liberal has no heart, but an old man who is not conservative has no mind." GB Shaw

  3. #3
    "Certified" Alphaholic Tim Kiebert's Avatar
    Real Name
    Tim Kiebert
    Join Date
    Jul 2004
    Location
    Geelong, Victoria, Australia
    Posts
    2,785

    Default Re: ctod()

    You don't know what date it is.


    Sorry, couldn't resist.:)
    Tim Kiebert
    Eagle Creek Citrus
    A complex system that does not work is invariably found to have evolved from a simpler system that worked just fine.

  4. #4
    "Certified" Alphaholic G Gabriel's Avatar
    Real Name
    G. Gabriel
    Join Date
    Oct 2004
    Posts
    7,204

    Default 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=mask(a," / / ")
    ?b
    = "4d/og/s 3c"

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

  5. #5
    "Certified" Alphaholic Mike Wilson's Avatar
    Real Name
    mike wilson
    Join Date
    Apr 2005
    Location
    Grand Rapids, Michigan
    Posts
    4,212

    Default 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.
    Mike W
    __________________________
    "I rebel in at least small things to express to the world that I have not completely surrendered"

  6. #6
    "Certified" Alphaholic G Gabriel's Avatar
    Real Name
    G. Gabriel
    Join Date
    Oct 2004
    Posts
    7,204

    Default 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!

Similar Threads

  1. CTOD (What am I doing wrong??)
    By Rich Hartnett in forum Alpha Five Version 7
    Replies: 14
    Last Post: 02-13-2007, 12:39 PM
  2. Xbasic - CTOD Problems with new computers
    By James Watson in forum Alpha Five Version 4
    Replies: 2
    Last Post: 03-21-2002, 04:05 AM
  3. Problem with CTOD
    By Jeff Kerman in forum Alpha Four Version 6 and Prior
    Replies: 4
    Last Post: 08-17-2000, 07:31 AM

Bookmarks

Posting Permissions

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