I have a small problem with an array. I get given a customer code which needs to be broken in an array (no problem). Lets pretend the customer code is sweets20. I need to break it down into 2 categories. 1, sweets, 2 the number (quantity).
My code
Expand|Select|Wrap|Line Numbers
- string array_PartNo = txtPartNo.Text;
- char[] array_PartNo02 = array_PartNo.ToCharArray();
- for (int i = 0; i < array_PartNo02.Length; i++) ;
- {
- string var_food = "";
- var_food += array_PartNo02[0];
- var_food += array_PartNo02[1];
- var_food += array_PartNo02[2];
- var_food += array_PartNo02[3];
- var_food += array_PartNo02[4];
- var_food = var_food.ToUpper();
So, it breaks the partno (sweets20) into individual characters, then it builds them up (eg, taking array 0 - 4 and turning it into a string. I can use the same method for the number of sweets with PartNo02[5] and PartNo02[06].
However, if some one ordered 100 sweets, the entire thing goes bad. I need a way of telling the program to count the last few (however long it may be)
Any ideas? I may be going totally the wrong way around this.
Thank you
Dave