This is a migrated thread and some comments may be shown as answers.

Problem with Substring, etc. (VB -> C#)

1 Answer 70 Views
Code Converter
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
bdukes
Top achievements
Rank 2
bdukes asked on 03 Feb 2009, 09:42 PM
Just ran into an issue with http://www.codechanger.com/, where I had code calling Substring() and the converter started throwing errors about bad syntax.

I was finally able to narrow it down to the following test case:
a.Substring(0, 1)
or just
a.Substring() 

It looks like its choking on the "Sub" part of it, thinking that it's the keyword, not part of a function name.  If you lowercase the sub, as follows:
a.substring(0, 1) 
this works and translates fine (though, obviously it doesn't make valid C#).

Just wanted to make sure this was documented.
Thanks

1 Answer, 1 is accepted

Sort by
0
Todd Anglin
Top achievements
Rank 2
answered on 04 Feb 2009, 05:36 PM
Thanks for reporting the issue. We'll take a look at our wrapper for code conversion and make sure we're not causing this problem. We do some "magic" to help support the conversion of snippets (vs. full code files) and they may be at play here. I'll take a look and update this thread if the issue can be reproduced and then fixed.

-Todd
Tags
Code Converter
Asked by
bdukes
Top achievements
Rank 2
Answers by
Todd Anglin
Top achievements
Rank 2
Share this question
or