4
I’m migrating a chunk of code in Visual Basic 6 and came across the following call:
variavel = Chr$(27) & Chr(15)
1 - What would be the equivalent functions in C#?
2 - What is the difference between Chr$
and Chr
?
4
I’m migrating a chunk of code in Visual Basic 6 and came across the following call:
variavel = Chr$(27) & Chr(15)
1 - What would be the equivalent functions in C#?
2 - What is the difference between Chr$
and Chr
?
3
Just make a cast of the number to char
, something like that:
(char)27
But I should probably do something different, the semantics of the language changes so it’s not usually just translating an expression, there must be another way to do this in C#, who knows even in VB6 it was already wrong to do this. One of the reasons I think this is that it makes no sense to use the two forms of function chr()
, one that returns String
and another that returns Variant
.
In C# probably use this:
"\u0027\u0015"
Complementing: the Asc()
is the opposite of the operation: (int)'c'
.
Browser other questions tagged c# .net string visual-basic-6 char
You are not signed in. Login or sign up in order to post.
In VB.NET: put the
$
at the end of the variable/function explicitly converts its value to aString
. How it works with the%
forInteger
also,&
forDouble
, etc. I don’t know if these other characters work on VB6.– CypherPotato