c# to vb.bet
-
hi, Could someone please translate this code to vb.net ?
static string str= "OKVALUES";
static string encode(string s)
{
string strTest = "";
for (int i = 0; i < s.Length; i++)
{
byte b = (byte)s[i];
strTest += str[b >> 4];
strTest += str[b & 0xf];
}
return strTest ;
}When you get mad...THINK twice that the only advice Tamimi - Code
-
hi, Could someone please translate this code to vb.net ?
static string str= "OKVALUES";
static string encode(string s)
{
string strTest = "";
for (int i = 0; i < s.Length; i++)
{
byte b = (byte)s[i];
strTest += str[b >> 4];
strTest += str[b & 0xf];
}
return strTest ;
}When you get mad...THINK twice that the only advice Tamimi - Code
-
hi, Could someone please translate this code to vb.net ?
static string str= "OKVALUES";
static string encode(string s)
{
string strTest = "";
for (int i = 0; i < s.Length; i++)
{
byte b = (byte)s[i];
strTest += str[b >> 4];
strTest += str[b & 0xf];
}
return strTest ;
}When you get mad...THINK twice that the only advice Tamimi - Code
Shared str As String = "OKVALUES"
Private Shared Function encode(ByVal s As String) As String
Dim strTest As String = ""
For i As Integer = 0 To s.Length - 1
Dim b As Byte = CByte(s(i))
strTest += str(b >> 4)
strTest += str(b And &Hf)
Next
Return strTest
End FunctionUsed: http://www.developerfusion.com/tools/convert/csharp-to-vb/[^]
-
hi, Could someone please translate this code to vb.net ?
static string str= "OKVALUES";
static string encode(string s)
{
string strTest = "";
for (int i = 0; i < s.Length; i++)
{
byte b = (byte)s[i];
strTest += str[b >> 4];
strTest += str[b & 0xf];
}
return strTest ;
}When you get mad...THINK twice that the only advice Tamimi - Code
Why downgrade perfectly good code ;P
only two letters away from being an asset
-
Shared str As String = "OKVALUES"
Private Shared Function encode(ByVal s As String) As String
Dim strTest As String = ""
For i As Integer = 0 To s.Length - 1
Dim b As Byte = CByte(s(i))
strTest += str(b >> 4)
strTest += str(b And &Hf)
Next
Return strTest
End FunctionUsed: http://www.developerfusion.com/tools/convert/csharp-to-vb/[^]
Dim b As Byte = CByte(s(i)) I think the above line will generate a compile error...like 'Char' values cannot be converted to 'Byte'.
Thanks Md. Marufuzzaman
Don't forget to click [Vote] / [Good Answer] on the post(s) that helped you. I will not say I have failed 1000 times; I will say that I have discovered 1000 ways that can cause failure – Thomas Edison.
-
Why downgrade perfectly good code ;P
only two letters away from being an asset
I do agree... :laugh: :laugh:
Thanks Md. Marufuzzaman
Don't forget to click [Vote] / [Good Answer] on the post(s) that helped you. I will not say I have failed 1000 times; I will say that I have discovered 1000 ways that can cause failure – Thomas Edison.
-
Dim b As Byte = CByte(s(i)) I think the above line will generate a compile error...like 'Char' values cannot be converted to 'Byte'.
Thanks Md. Marufuzzaman
Don't forget to click [Vote] / [Good Answer] on the post(s) that helped you. I will not say I have failed 1000 times; I will say that I have discovered 1000 ways that can cause failure – Thomas Edison.
I agree.
Dim b As Integer = Microsoft.VisualBasic.AscW(s(i))
should solve that. :)Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
Local announcement (Antwerp region): Lange Wapper? Neen!
-
hi, Could someone please translate this code to vb.net ?
static string str= "OKVALUES";
static string encode(string s)
{
string strTest = "";
for (int i = 0; i < s.Length; i++)
{
byte b = (byte)s[i];
strTest += str[b >> 4];
strTest += str[b & 0xf];
}
return strTest ;
}When you get mad...THINK twice that the only advice Tamimi - Code
Thank you all :)
When you get mad...THINK twice that the only advice Tamimi - Code