StrComp not working on some systems

I have a very strange issue.
I use StrComp to see if a string contains lower case chars or not.
I do this:

var t as string = “Aef6V”
if StrComp( t , Uppercase(t) , 0) = 0 then
msbox "Does not contain lowercase chars’
else
msgbox "Does contain lowercase chars’.

On a users computer (I think he is chinees), the above returns it does not contain lowercase chars. But it should.

Any ideas why?
end

Probably something related to Locale, Unicode and Xojo i18n internals that only Xojo could know.
MAYBE the Uppercase(t) fails and returns the same value as t because his Locale.

I would consider that a bug, not?

Is there another way to check this (check for lowercase chars)?

I would say it may be. You must to get a way to reproduce it. Find his locale and try to mimic his system. Once you have a mean to reproduce it, open a bug report.

Have in mind that “lower case chars” can vary depending on the language. â is lower case for  and probably the utf solution on the Xojo side would be the best way of doing it. But one way could be using a regex looking for a list of those lowercase chars like [a-záãâ…] (incomplete)

There are unicode-savvy tokens. I think it’s \p{Ll} but would have to check later.

Unicode normalization might help here too.

That may be the case but in this case it isn’t.
The string is Aef6V
If you declare a string and set it to Aef6V, it shouldn’t matter on what device/location/encoding … the above Strcmp should work fine (but it doesn’t).

@Kem: I know you are a guru with RegEx. :slight_smile: Is there a way to use RegEx to see if a string has lowercase chars?

Do you want to check if a string is exactly equal to this string only?

have you tried an API2 approach e see if it bugs too?

Var token As String = "Aef6V"
Var anotherString As String = "AEf6v" // differs

If token.Compare(anotherString, ComparisonOptions.CaseSensitive) = 0 Then
  MessageBox "it matches"
Else
  MessageBox "it differs"
End

I’ll let you both looking for the perfect regex here. I know that Kem will find the best one possible. :wink:

Kem will but you have to ask in Klingon:

'ej qeylIS Dalo’chugh yInejQo’chugh,

veng Sup lengtaHvIS

I think you missed my previous post, but here it is in detail.

var rx as new RegEx
rx.SearchPattern = "\p{Ll}"
if rx.Search( token ) isa RegExMatch then
  // has lowercase
end if

(The pattern is right, but excuse typos in the code.)

1 Like

Thanks Kem! (Yes, missed the previous answer - sorry about that).