|
-
May 2nd, 2004, 04:03 PM
#1
Thread Starter
Addicted Member
VB6 Functions In C#
Hey people
im learning c# and was wondering what the equivalents are of functions in VB 6 like
VB Code:
chr()
asc()
now()
mid()
split()
left()
right()
strreverse()
i looked on google but cant see much about them
-
May 2nd, 2004, 04:51 PM
#2
PowerPoster
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.
-
May 10th, 2004, 05:00 PM
#3
Chr()
Convert.ToString(65)
Asc()
Convert.ToByte('A')
-
May 11th, 2004, 04:06 AM
#4
a couple more Chr variations ...
VB Code:
char chr = (char)65; // same as Chr(65)
char chr1 = Convert.ToChar(65); // same as Chr(65)
~
if a post is resolved, please mark it as [Resolved]
protected string get_Signature(){return Censored;}
[vbcode][php] please use code tags when posting any code [/php][/vbcode]
-
May 11th, 2004, 01:53 PM
#5
i dug out a function i made ages ago in C# for reversing strings , here ya go...
PHP Code:
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);
}
Last edited by dynamic_sysop; May 11th, 2004 at 03:55 PM.
~
if a post is resolved, please mark it as [Resolved]
protected string get_Signature(){return Censored;}
[vbcode][php] please use code tags when posting any code [/php][/vbcode]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|