Grabbing each character of a string, how?
-
i have a string and i was wondering how i could grab each character of that string for example in c++ if string="Hello World" then string[3] would return a "l" thank you --------------------- And Like The Wind Our Hero Vanishes Off Into The Distance...
-
i have a string and i was wondering how i could grab each character of that string for example in c++ if string="Hello World" then string[3] would return a "l" thank you --------------------- And Like The Wind Our Hero Vanishes Off Into The Distance...
mid("Hello World",4,1) returns "l" note that in VB6 the first character index is 1 not 0 like C.
-
mid("Hello World",4,1) returns "l" note that in VB6 the first character index is 1 not 0 like C.
awsoem thank you --------------------- And Like The Wind Our Hero Vanishes Off Into The Distance...
-
i have a string and i was wondering how i could grab each character of that string for example in c++ if string="Hello World" then string[3] would return a "l" thank you --------------------- And Like The Wind Our Hero Vanishes Off Into The Distance...
You can also get them easily using the Chars property:
Dim s As String Dim i As Integer s = "one for the toad" For i = 0 To (s.Length - 1) Console.WriteLine(s.Chars(i)) Next
Note that most of the properties, etc. dealing with arrays in the BCL use zero-based indexing. It can be confusing switching back and forth between zero- and one-based indexing. [EDIT] I misunderstood, and assumed the question was for VB .NET . I apologize. Back to the C# forums for this geek. [/EDIT] Regards, Jeff Varszegi EEEP! An Extensible Expression Evaluation Package