comparing characters with diacritic signs

P

Pablo Cardellino

Hi,
is there any setting for comparing characters with diacritic signs?

I need this sample comparisons to be evaluated as true:

a = Á
e = ê
C = ç
I = í

and so on.

Option Compare Text helps for case insensitive comparison, but not to
compare diacritic characters.

I've already written a function to do this, but I think it should be a
native way for.

Thanks in advance,

Pablo Cardellino
Florianópolis, SC
Brazil
 
K

Klaus Linke

Hi Pablo,

I'm not aware of a *direct* built-in way, but this seems to work:

? StrConv("Á", vbLowerCase, 8)
a

? StrConv("ê", vbLowerCase, 8)
e

? StrConv("ç", vbLowerCase, 8)
c

? StrConv("í", vbLowerCase, 8)
i

(I got the LCID of 8 simply by trying... assuming there would be one that
would work, and 8 was the first value that did)

So a simple function for your purpose could be:

Function Norm(Char1 As String) As String
If Len(Char1) <> 1 Then
MsgBox "Error: Function meant to work on single characters!"
End If
Norm = StrConv(Char1, vbLowerCase, 8)
End Function

.... and then compare

? Norm("a") = Norm("Á")
True

? Norm("C") = Norm("ç")
True

? Norm("é") = Norm("A")
False

etcetera

Regards,
Klaus
 
K

Klaus Linke

I've just tested the Norm function, and the following Unicode characters are
converted to "a":

AaÀÁÂÃÄÅàáâãäåAaAaAaAaAaAa

While it's not perfect (... say I'd have hoped to see characters from "Latin
Extended Additional" with uncommon and/or multiple accents), it's not bad
either.

Klaus
 
K

Klaus Linke

Why didn't that get across as Unicode? Another try:



a = AaÀÃÂÃÄÅàáâãäåĀÄĂ㥹ÇǎǞǟAï½

b = BbƀBb

c = CcÇçĆćĈĉĊċČÄCc

d = DdÄŽÄÄđ♪♫Dd

e = EeÈÉÊËèéêëĒēĔĕĖėĘęĚěEe

f = FfFf

g = GgÄœÄĞğĠġĢģǤǥǦǧGg

h = HhĤĥĦħHh

i = IiÃŒÃÃŽÃìíîïĨĩĪīĬĭĮįİƗÇÇIi

j = JjĴĵǰJj

k = KkĶķǨǩKk

l = LlĹĺĻļĽľÅłƚ∟└╚Ll

m = Mmï¼­ï½

n = NnÑñŃńŅņŇňNn

o = OoÒÓÔÕÖØòóôõöøŌÅÅŽÅÅőƟƠơǑǒǪǫǬǭ☺☻Oï½

p = Ppï¼°ï½

q = QqQq

r = RrŔŕŖŗŘřRr

s = SsŚśŜÅŞşŠšSs

t = TtŢţŤťŦŧƫƮ┬╦Tt

u = UuÙÚÛÜùúûüŨũŪūŬŭŮůŰűŲųƯưǓǔǕǖǗǘǙǚǛǜUu

v = Vv↓Vv

w = WwŴŵWw

x = XxXx

y = YyÃýÿŶŷŸYy

z = ZzŹźŻżŽžZz
 
P

Pablo Cardellino

Thanks Klaus,
it worked fine, and yet it is not a native function, it is much more
economic than the one I'd written.
Regards,

Pablo Cardellino
Florianópolis, SC
Brazil
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top