24. juli 2001 - 09:48
Der er
11 kommentarer og 2 løsninger
Tjekke om en char er et stort eller et lille bogstav
Hejsa Hvordan tjekker man på en smart måde, om en given karakter er et stort eller et lille bogstav ? Jeg bruger VB5. Tak på forhånd Christian
Annonceindlæg tema
Cloud & AI
I dette særtema ser vi på, hvordan cloud og AI bliver fundamentet for virksomhedernes digitale forretning, og hvordan de nye muligheder for automatisering og forretningsværdi kan udnyttes uden at miste overblik, sikkerhed og menneskelig kontrol.
if Char = UCase(Char) then msgbox \"Stort\" else msgbox \"Lille\" endif
If Asc(char) < 97 Then MsgBox \"Stort\" Else MsgBox \"Lille\" End If
Using ASC is going to give problems with special characters such as the danish Å, Æ, and Ø. You can use ASC() to find values of other characaters and place then in your IF \'198 = Æ If Asc(char) < 97 Or Asc(char) = 198 Then
doh Jeg havde sq slet ikke tænkt i de baner :) Bruger Proaccess foreslag ! Takker
proaccess> Just a comment, but I cant get your answer to work, can you picard?
Yeah.... It works just fine :)
test with lower case characters!
terry> I think that you are testing a string (of more than 1 character)... If that\'s not the case, then you may have a reference-problem...
Well I must have a reference/problem on three PC\'s! Two running NT4.0 and another 2000! I must admit, looking at it I cant see why it shouldnt work, but no... Anyway, not to worry, its not me needing help (yet!)
24. juli 2001 - 12:13
#10
proaccess> Found the problem! It works as expected in VB but in Access it doesnt, do you have the same problem?
24. juli 2001 - 12:22
#11
Yes, I got the same error in Access... :-( BUT, here\'s the solution (combining our answers): If Asc(Char) = Asc(UCase(Char)) Then MsgBox \"Stort\" Else MsgBox \"Lille\" End If
24. juli 2001 - 12:26
#12
Yes, I\'ll buy that! terry
24. juli 2001 - 12:27
#13
Nice one :)
Kurser inden for grundlæggende programmering