I'm testing an input to see if it consists of Japanese characters, which fall within a certain unicode block. I could do it with If, but I like the neater syntax for Select Case. Said that, I'm not quite sure how to write a "Case" that excludes numbers falling between two values.
This works, but could possibly be written more concisely:
For Each c As Char In jpstring
Select Case AscW(c)
Case 12352 To 12543, 12784 To 12799
Case Else
Return False
End Select
Next
I tried doing something like:
Case Not 12352 To 12543, 12784 To 12799
But that doesn't work, and nor does wrapping it in brackets like below:
Case Not (12352 To 12543, 12784 To 12799)
Is there a way to write a Case so that it specifically excludes multiple ranges of numbers?
AFAIK there is no way to have a
Casematch an excluded range. However, you could use>and<:Of course, if you only want to return
TrueorFalse, it may be more concise to simply return the result of the comparison: