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

We encourage new members to introduce themselves here. Get to know one another and share your interests.
Post Reply
koeidelix
Posts: 41
Joined: Tue Apr 03, 2018 10:44 am
Location: Deutschland

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

Post 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
User avatar
wriedmann
Posts: 3668
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

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

Post 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
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
koeidelix
Posts: 41
Joined: Tue Apr 03, 2018 10:44 am
Location: Deutschland

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

Post 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
User avatar
wriedmann
Posts: 3668
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

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

Post 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
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
koeidelix
Posts: 41
Joined: Tue Apr 03, 2018 10:44 am
Location: Deutschland

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

Post by koeidelix »

fine.
thank you Wolfgang
Post Reply