RE: Splits & Arrays & For Each Loops MSVS 2012 02-27-2013, 06:26 PM
#2
If you're going to post a tutorial, what you say should be proper as well as the code that goes with it.
"splits and arrays"? *Almost implying that they are similar things here.
Split() is a method, an Array is a range of elements that can be accessed by index.
That would be a better reflection of a multi-dimensional (2D) array. Rows and Columns cannot be expressed within a single dimensional array really. There's also jagged arrays, which is more like groups of groups.
Your "uses" are comfusing as well:
Arrays are more efficient than complex algorithms??
Arrays can use complex algorithms...
You also shouldn't be promoting this:
1. Bad naming convention here
2. You shouldn't be declaring it as just an Array
3. This will fail with option strict on, because implicit type casting is happening with that string being converted to a char.
4. There's nothing explicit about this:
5. Debatable, but in VB.NET for string concatenation you should be using & over +:
Quote:I hope to provide you all with a greater understanding of splits and arrays.
"splits and arrays"? *Almost implying that they are similar things here.
Split() is a method, an Array is a range of elements that can be accessed by index.
Quote:An array is a systematic arrangement of objects, usually in rows and columns.
That would be a better reflection of a multi-dimensional (2D) array. Rows and Columns cannot be expressed within a single dimensional array really. There's also jagged arrays, which is more like groups of groups.
Your "uses" are comfusing as well:
Quote:Better Organizing Data
Passing Variable Data In Line
Easier To Process Web Strings
More Efficient Than Complex Algorithms
Arrays are more efficient than complex algorithms??
Arrays can use complex algorithms...
You also shouldn't be promoting this:
Code:
Dim OurArray As Array1. Bad naming convention here
2. You shouldn't be declaring it as just an Array
3. This will fail with option strict on, because implicit type casting is happening with that string being converted to a char.
Code:
OurArray = txtInput.Text.Split("|")Code:
For Each ArrayItem In OurArray
NextCode:
MessageBox.Show("The current string in the array is: " + ArrayItem, "Our Array's Contents", MessageBoxButtons.OK, MessageBoxIcon.Information)
-- cxS
[ Haskell/.NET/C/C++ - Software Engineer ]

![[+]](https://sinister.li/images/modern/collapse_collapsed.png)