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

Converting C# string literals to VB is missed up #84

Open
VBAndCs opened this issue Jul 3, 2022 · 0 comments
Open

Converting C# string literals to VB is missed up #84

VBAndCs opened this issue Jul 3, 2022 · 0 comments

Comments

@VBAndCs
Copy link

VBAndCs commented Jul 3, 2022

Try this:

string[] x = new[] {
"{\\rtf1\\ansi\\ansicpg\\lang1024\\noproof65001\\uc1 \\deff0{\\fonttbl{\\f0\\fnil\\fcharset0\\fprq1 Consolas;}}",
"\\fs24 ",
"\\cf0 {0}", 
"\\", 
"\\\\", 
"\\{",
"\\}",	
"{\\b ",
"\\cf{0} {1}{2}{3}{4}{5}",
"\\cf0 {0}","\\}",
"\\par ",
"{\\colortbl;\r\n",
"\\red{0}\\green{1}\\blue{2};"
}

Most string literals will not be translated correctly.

Dim x As String() = {
"{\rtf1{&H7}nsi{&H7}nsicpg\lang1024{vbLf}oproof65001\uc1 \deff0{{ChrW(12)}onttbl{{ChrW(12)}0{ChrW(12)}nil{ChrW(12)}charset0{ChrW(12)}prq1 Consolas;}}",
"{ChrW(12)}s24 ",
"{vbCr}f0 {0}",
"\",
"\",
"\{",
"\}",
"{{ChrW(&H8)} ",
"{vbCr}f{0} {1}{2}{3}{4}{5}",
"{vbCr}f0 {0}", "\}",
"\par ",
"{{vbCr}olortbl;",
"\red{0}\green{1}{ChrW(&H8)}lue{2};"}

The correct result should be:

Dim x() As String = { "{\rtf1\ansi\ansicpg\lang1024\noproof65001\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Consolas;}}", 
"\fs24 ", 
"\cf0 {0}", 
"\", 
"\\", 
"\{", 
"\}", 
"{\b ", 
"\cf{0} {1}{2}{3}{4}{5}", 
"\cf0 {0}",
"\}", 
"\par ", 
"{\colortbl;" & vbCrLf, 
"\red{0}\green{1}\blue{2};" 
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant