Click to See Complete Forum and Search --> : VB6 Functions In C#
señorbadger
May 2nd, 2004, 04:03 PM
Hey people
im learning c# and was wondering what the equivalents are of functions in VB 6 like
chr()
asc()
now()
mid()
split()
left()
right()
strreverse()
i looked on google but cant see much about them
hellswraith
May 2nd, 2004, 04:51 PM
chr() - ?
asc() - ?
now() - DateTime.Now
mid() - myString.SubString(5,3)
split() - myString.Split(" ")
left() - myString.SubString(0, 5)
right() - myString.SubString(myString.Length - 5)
strreverse() - ?
Sorry I don't know the others off the top of my head. Look at the different functions you can do with a string variable. This will lead you to answering what you need answered. There is also the System.Text namespace, or the char data type that allows other things.
Serge
May 10th, 2004, 05:00 PM
Chr()
Convert.ToString(65)
Asc()
Convert.ToByte('A')
dynamic_sysop
May 11th, 2004, 04:06 AM
a couple more Chr variations ...
char chr = (char)65; // same as Chr(65)
char chr1 = Convert.ToChar(65); // same as Chr(65)
dynamic_sysop
May 11th, 2004, 01:53 PM
i dug out a function i made ages ago in C# for reversing strings , here ya go...
private void button1_Click(object sender, System.EventArgs e)
{
MessageBox.Show(StringReverse("test 123"));
}
private string StringReverse(string ToReverse)
{
Array arr = ToReverse.ToCharArray();
Array.Reverse( arr ); // reverse the string
char[] c = (char[])arr;
byte[] b = System.Text.Encoding.Default.GetBytes(c);
return System.Text.Encoding.Default.GetString(b);
}
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.