Example CHGDAT2.PRT
; CHGDAT2
;
; Program for Proteus
;
; (C) 1998-2004 Simone Zanella Productions
;
; Change in each line the first date found from the format 'dd/mm/yy[yy]'
; to the format 'dd mmm yyyy'; the date must use at least one of the
; separators in Seps (which must also include ' ').
; This program is similar to chgdate.prt, but uses the library functions
; for dates and the dynamic tokenizer to speed up operations.

; Initialize variables
FUNCTION ONSTART()

  IF STREQ(ARGV(3), "..")
    CONSOLELN "Syntax: " ARGV(1) " " ARGV(2) " source destination"
    CONSOLELN ""
    CONSOLELN "Purpose: change dates from numeric to alphanumeric"
    ABORT 0
  FI

  _Seps = " ,;:.()[]<>-{}"
  _MONTHS = "Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec"
RETURN


TKH = TOKNEW(L, Seps)

; Save token number in line
NTK = TOKNUM(TKH)
NewL = L

; For each token..
FOR CurTok = 1 TO NTK

  PL = TOKGET(TKH, CurTok)

  ; The token is a date?
  IF ISDATE(PL)
    ; Find where the date is in NewL
    P = TOKPOS(TKH, CurTok)

    ; Replace date in NewL
    NewL = INSERT(DELETE(NewL, P, STRLEN(PL)), P, \
                  ; New date
                  PADL(DAY(PL), 2, " ") " " CMONTH(PL) " " YEAR(PL))

    ; Exit from FOR, because the position of the following tokens has changed
    BREAK
  FI
NEXT

TOKFREE(TKH)

PRINTLN NewL
Samples index Next example Previous example Contents Index
Midnight Lake iPhone Case Black Women Shoes Black Flat Shoes Leather Flats Black Patent Ballerinas Black Ballet Shoes Casual Shoes Black Shoes Women Balle Record Player Cufflinks Best iPhone XR Clear Cases iPhone XS/XS Max Leather Cases Sale Best iPhone 8/8 Plus Silicone Cases iPhone 7/7 Plus Cases & Screen Protector New Cases For iPhone 6/6 Plus iPhone 8 Case Sale iPhone Xr Case Online iPhone 7 Case UK Online iPhone X Case UK Sale iPhone X Case Deals iPhone Xs Case New Case For iPhone Xr UK Online Case For iPhone 8 UK Outlet Fashion Silver Cufflinks For Men Best Mens Cufflinks Outlet Online The Gold Cufflinks Shop Online Cheap Shirt Cufflinks On Sale Nice Wedding Cufflinks UK Online Top Black Cufflinks UK Online Mens Cufflinks Online Silver Cufflinks For Men Men Cufflinks UK Sale Gold Cufflinks UK Online Gold Cufflinks UK Silver Cufflinks UK Shirt Cufflinks Discount Online Mens Cufflinks Deals & Sales Girls Shoes For Dance Fashion Ballet Dance Shoes Best Ballet Flats Shoes UK Online Cheap Ballet Pointe Shoes UK Online Best Ballet Shoes Outlet Best Dance Shoes Sale Cheap Ballet Flats Sale UK Best Pointe Shoes Online UK Ballet Dance Shoes UK Shoes For Dance UK Best Ballet Slippers Shop Best Yoga Shoes Hotsell