Binnen en buiten ASCII text (leestekens, extended)

Om bestandsnamen te maken, namen van mappen, e-mail adressen, tekst voor opslag in een database veld, html, enz is het soms nodig om enkel bepaalde tekens te gebruiken. Enkele “sub-sets”:

Letters en cijfers:

Chr(i) waarbij i is:

  • 48 tot 57 = 1 .. 9
  • 65 tot 90 = A .. Z
  • 97 tot 122 = a .. z

Normale standaard tekens:

Chr(i) waarbij i is:

  • 32 (spatie) tot 126 ~ (tilde)
  • met daartussen leestekens, haakjes, cijfers, letters enz

Extended:

Chr(i) waarbij i is:

  • 128 tot 255 (niet printbaar)

Weergeven:


Public Sub Main()
Dim sStandaard, sExtend, sPureText As String
Dim iCount As Short

For iCount = 48 To 57
sPureText &= Chr(iCount)
Next

For iCount = 65 To 90
sPureText &= Chr(iCount)
Next

For iCount = 97 To 122
sPureText &= Chr(iCount)
Next

For iCount = 32 To 126
sStandaard &= Chr(iCount)
Next

For iCount = 128 To 255
sExtend &= Chr(iCount)
Next

Print "sPureText = " & sPureText
Print "sStandaard = " & sStandaard
Print "sExtend = " & sExtend

This entry was posted in Gambas3, Hoe - in Gambas. Bookmark the permalink.