(Documentation) Bug: AscW(ChrW(x)) <> x
- Dominant language
- No language data
- Stars
- 328
- Forks
- 71
- PR merge metrics
- No merged PRs in 30d
Description
Form the documentation (https://docs.microsoft.com/en-us/dotnet/api/microsoft.visualbasic.strings.chrw?view=netframework-4.8):
> Returns the character associated with the specified character code.
> public static char ChrW (int CharCode);
> Parameters
> CharCode
> Int32
> Required. An Integer expression representing the code point, or character code, for the character.
> Returns
> Char
> The character associated with the specified character code.
> Exceptions
>
> ArgumentException
> CharCode < -32768 or > 65535 for ChrW.
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:
```
Public Function test() As Integer
For i As Integer = -32768 To 65535
If i <> Microsoft.VisualBasic.AscW(Microsoft.VisualBasic.ChrW(i)) Then
Return i
End If
Next
Return -99999
End Function
```
And this test function fails for **every** negative input.
All positive input (and zero) works fine.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.