' Gambas module file

' Public Sub Main()
' 
'   Dim I As Integer
'   Dim fTimer As Float
'   Dim sData As String
' 
'   sData = File.Load("~/.local/share/gambas3/wiki/data/en/doc/object-model/~page")
' 
'   fTimer = Timer
'   For I = 1 To 1000
'     String.RemoveDiacritics(sData)
'   Next
'   Print Timer - fTimer
' 
' End

Public Sub Main()

  'Print String.RemoveDiacritics("activité")
  Dim sTimeZone As String
  
  Print Format(Date.FromRFC822("Tue, 2 Apr 2024 00:47:32 +0200", ByRef sTimeZone), gb.GeneralDate)
  Print sTimeZone
  

  'Print String.PadLeft("Gambas", 16, "×->")
  'Print String.PadRight("Gambas", 16, "×->")
  'Print Now;; Date.ToISO8601(Now);; Date.ToISO8601(Now, "-0200")
  
  'Print DateAdd(Date.EasterDay(2020), gb.Day, 40)
  
  ' Print String.ToPhonetic("Le comte (de Monte-Cristo) ; le conte (du Petit Chaperon Rouge) ; le compte (en banque)", "fr_FR")
  ' 
  ' Print String.ToPhonetic("Dans cet antre, lassés de gêner au palais", "fr_FR")
  ' Print String.ToPhonetic("Dansait, entrelacés, deux généraux pas laids", "fr_FR")
  ' 
  ' Print String.ToPhonetic("Elle sort là-bas des menthes, la belle Eve à l'âme hantée", "fr_FR")
  ' Print String.ToPhonetic("Et le sort l'abat, démente, l'abbé laid va lamenter", "fr_FR")

End

Public Sub RFC822Test()

  Dim sTimeZone As String

  ' Must be correct in the local timezone
  Print CStr(Now)
  Print Format(Now)
  Print CStr(Date.FromRFC822("Sun, 21 Apr 2019 05:00:00 +0000"))
  Print Format$(Date.FromRFC822("Sun, 21 Apr 2019 05:00:00 +0000"))
  Print Date.FromRFC822("Sun, 21 Apr 2019 05:00:00 +0100")
  Print Date.FromRFC822("Tue, 1 Jan 2019 00:00:00 +0800")
  Print Date.ToRFC822(Now)
  Print Date.ToRFC822(Now, "+0100")
  Print "---"
  ' Timezone to-from conversion should be the identity mapping
  Print Date.ToRFC822(Date.FromRFC822("Sun, 21 Apr 2019 05:00:00 +0000"), "+0000")
  Print Date.ToRFC822(Date.FromRFC822("Sun, 21 Apr 2019 05:00:00 +0000"), "+0100")
  Print Date.ToRFC822(Date.FromRFC822("Sun, 21 Apr 2019 05:00:00 +0000"), "+0800")
  Print Date.ToRFC822(Date.FromRFC822("Sun, 21 Apr 2019 05:00:00 +0100"), "+0000")
  Print Date.ToRFC822(Date.FromRFC822("Sun, 21 Apr 2019 05:00:00 +0100"), "+0100")
  Print Date.ToRFC822(Date.FromRFC822("Sun, 21 Apr 2019 05:00:00 +0100"), "+0800")
  Print Date.ToRFC822(Date.FromRFC822("Sun, 21 Apr 2019 05:00:00 +0800"), "+0000")
  Print Date.ToRFC822(Date.FromRFC822("Sun, 21 Apr 2019 05:00:00 +0800"), "+0100")
  Print Date.ToRFC822(Date.FromRFC822("Sun, 21 Apr 2019 05:00:00 +0800"), "+0800")
  Print "---"
  ' Ability to extract timezone
  Date.FromRFC822("Sun, 21 Apr 2019 05:00:00 +0100", ByRef sTimeZone)
  Print sTimeZone
  ' 21 Apr 2019 is not a Wednesday
  Try Date.FromRFC822("Wed, 21 Apr 2019 05:00:00 +0100")
  If Error Then Print Error.Text

End
