S
Skeletron
Guest
Are you sick and tired of VB.net having functions like Asc, StrReverse, IsNumeric that C# does not have.
Well, this is what I use in C# that is the same as those functions but created 100% by me. When I moved to C# I noticed that most of the functions like these old Com components that are still incorporated in VB.net were not anywhere on C#. So, best thing I had to do is to built them my self.
These functions are extremely fast; much faster then the VB.net's one's.
I have not had time to finish up the Chr in here that operates with Asc but the Chr function for now only support one letter.
Hopefully these can be used in your programs.
~Skeletron
Well, this is what I use in C# that is the same as those functions but created 100% by me. When I moved to C# I noticed that most of the functions like these old Com components that are still incorporated in VB.net were not anywhere on C#. So, best thing I had to do is to built them my self.
These functions are extremely fast; much faster then the VB.net's one's.
public static string Asc(string String)
{
try
{
string Compile = "";
int ascvalue;
char chr;
System.Collections.ArrayList ListItems = new System.Collections.ArrayList();
for (int I = 0; I < String.Length; I++)
{
ListItems.Add(Convert.ToString(String.Substring(I, 1)));
chr = Convert.ToChar(ListItems);
ascvalue = (int)chr;
Compile = Compile + ascvalue;
}
return Compile;
}
catch
{
return;
}
}
public static bool IsNumeric(string ValidString)
{
try
{
Int32.Parse(ValidString);
}
catch
{
return false;
}
return true;
}
public static string StrReverse(string UnReversed)
{
System.Collections.ArrayList Items = new System.Collections.ArrayList();
String Part;
String Compile = "";
for (int I = 0; I < UnReversed.Length; I++)
{
Part = Convert.ToString(UnReversed.Substring(I, 1));
Items.Add(Part);
}
Items.Reverse();
for (int X = 0; X < Items.Count; X++)
{
Compile = Compile + Convert.ToString(Items[X]);
}
return Compile;
}
public static bool Kill(string FileName)
{
try
{
System.IO.File.Delete(FileName);
}
catch
{
return false;
}
return true;
}
public static string Chr(string AscString)
{
try
{
int AscInt;
Char chr;
AscInt = Convert.ToInt32(AscString);
chr = Convert.ToChar(AscInt);
return Convert.ToString(chr);
}
catch
{
return;
}
}
I have not had time to finish up the Chr in here that operates with Asc but the Chr function for now only support one letter.
Hopefully these can be used in your programs.
~Skeletron



