Open tverweij opened 4 years ago
It looks like a documentation bug as Unicode = UTF16 and 16 bit conforms to 0 to 65535 or -32768 to 32767 and not -32768 to 65535
Docs are OSS! I'm going to leave this as "great first issue" for the moment
@KathleenDollard The parameter check in VB is according to the docs. But the negative values are meaningless. In (almost) all cases AscW(ChrW(negative value)) returns -1.
I think this error is a leftover from VB6 where Integer was 16 bit and the ranges was - 32768 to 32767.
Form the documentation (https://docs.microsoft.com/en-us/dotnet/api/microsoft.visualbasic.strings.chrw?view=netframework-4.8):
And AscW is the opposite of that. That means that AscW(ChrW(x)) = x
So, the range to check is -32678 to 65535 Test code:
And this test function fails for every negative input. All positive input (and zero) works fine.