Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VB -> C#: Strings.Instr case insensitive #655

Closed
marcal opened this issue Oct 13, 2020 · 2 comments
Closed

VB -> C#: Strings.Instr case insensitive #655

marcal opened this issue Oct 13, 2020 · 2 comments
Labels
output logic error A bug where the converted output behaves differently to the input code VB -> C# Specific to VB -> C# conversion

Comments

@marcal
Copy link

marcal commented Oct 13, 2020

Hello,
I have seen another problem (linked to the #579 ), Strings.Instr has the same problem.

Input code

si_Pos = Strings.InStr(1, astr_Error, "object '")

Erroneous output

si_Pos = Strings.InStr(1, astr_Error, "object '");

Expected output

si_Pos = Strings.InStr(1, astr_Error, "object '", Constants.vbTextCompare);

Details

  • Product in use: https://codeconverter.icsharpcode.net (extension .NET too).
    When the project is in TextCompare, instr must compare texts as texts so Constants.vbTextCompare is mandatory to have the same result.

Thank you
Marc

@marcal marcal added the VB -> C# Specific to VB -> C# conversion label Oct 13, 2020
@GrahamTheCoder
Copy link
Member

Thanks, this should be easy enough to fix. I wonder if there's a place in docs/compiler that lists all these related cases

@marcal
Copy link
Author

marcal commented Oct 15, 2020

Hello,

Thank you
I don't think there is such a list but here are some I know of

https://docs.microsoft.com/en-us/dotnet/visual-basic/language-reference/statements/option-compare-statement
InStr
InStrRev
Replace
Split
StrComp
// >
// <
//=
// <>

Doing a shift+F2 on such a function (strings.Instr) opens the metadata that gives the following for strings
Filter (so it seems OK)
Instr, InstrRev, Replace , Split, strComp,
I think it is all for de Visualbasic dll

There are also other things in a declared string (instead of strings). This one doesn't use
string Toto; (for the StringComparison Enum)
Toto.IndexOf and shift+F2 gives
Compare (some of them)
EndsWith
Equals
IndexOf(
LastIndexOf
Split
StartsWith

I think it is all (at least that I know about).

Marc

@GrahamTheCoder GrahamTheCoder added the output logic error A bug where the converted output behaves differently to the input code label Jun 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
output logic error A bug where the converted output behaves differently to the input code VB -> C# Specific to VB -> C# conversion
Projects
None yet
Development

No branches or pull requests

2 participants