I'm not an expert at nested for loops and I need help with the following...
I need to extract numeric values from a string and 'discard' any alphabetical characters in the same string. In this case, there will always only be a sequence of 2 numeric strings.
The purpose of this is to append station using racks, should the station need expanding at a later stage. Here's what I have...
Expand|Select|Wrap|Line Numbers
- string stationCoordinates = stationObjects.StationXY;
- char[] digits = new char[] { '1', '2', '3', '4', '5', '6', '7', '8', '9', '0' };
- int rowNumber = 0;
- int columnNumber = 0;
- StringBuilder numericString = new StringBuilder();
- for (int i = 0; i < stationCoordinates.Length; i++)
- {
- for (int j = 0; j < stationCoordinates.Length; j++)
- {
- if (char.IsNumber(stationCoordinates[i]))
- {
- numericString.Append(stationCoordinates[i]);
- rowNumber = i;
- }
- }
- }
Lets say, for instance, stationCoordinates' value is "Row33Col44", I want the 33 (i) and 44 (j), which value's should be incremented accordingly in my append method. Any ideas?