xsharp.eu • Why is É between A and Z? (VO and X#)
Page 1 of 1

Why is É between A and Z? (VO and X#)

Posted: Thu Nov 26, 2020 3:01 pm
by koeidelix
Hello,
need help with the following problem.

Why is É (201) between A (65) and Z (90)?

Local l as Logic
Local c as string
Local n as dword

n := Asc("É") <--201
n := Asc("A") <-- 65
n := Asc("Z") <-- 90

c := "É"
l := c >= "A" .and. c <= "Z" <-- is true

thank you
Thomas

Why is É between A and Z? (VO and X#)

Posted: Thu Nov 26, 2020 3:39 pm
by wriedmann
Hi Thomas,
that depends on your nation module (if you are using a nation module) or your system.
The German nation module and/or a German language system should sort that between "E" and "F".
Wolfgang

Why is É between A and Z? (VO and X#)

Posted: Thu Nov 26, 2020 3:51 pm
by koeidelix
Hi Wolfgang,
thanks for the explanation.
I only want to allow the letters "A" to "Z". Do I have to check the Asc() values. Is that enough?
Or better look for a .Net-Method?
Thomas

Why is É between A and Z? (VO and X#)

Posted: Thu Nov 26, 2020 4:26 pm
by wriedmann
Hi Thomas,
if you are using the VO runtime, you can use the ASC() function.
The Char:IsLetter() method returns true for every valild unicode character.
On your string you could use regular expressions:

Code: Select all

Regex.IsMatch(hello, @"^[a-zA-Z]+$")
Source: https://stackoverflow.com/questions/128 ... rom-a-to-z
Wolfgang

Why is É between A and Z? (VO and X#)

Posted: Thu Nov 26, 2020 4:30 pm
by koeidelix
fine.
thank you Wolfgang