Hello...How can i read each character in a string? i know i VB there is a function called MID that allows me to do reading of each character but is there same function as MID in C#.NEt?
Printable View
Hello...How can i read each character in a string? i know i VB there is a function called MID that allows me to do reading of each character but is there same function as MID in C#.NEt?
That would be the .Substring function.
You shouldn't be using Mid for that in VB.NET anyway. Mid returns a String. You should be using the Chars property of the String object, e.g.You really should stop all this "what's the C# equivalent" business. People with no VB experience have to learn C# from scratch without converting VB functions. Just use some logical thinking. You have a string and you want to get each character. That's probably got something to do with the String class and/or the Char structure. Go to the documentation for those types and you'll see what you're after.Code:foreach (char c in myString)
{
MessageBox.Show(c);
}
Ok..Sorry for that...I'n just used to VB6 thats why i keep on comparing things...but dont worry i'll try to get rid of that..