This week's book giveaways are in the Refactoring and Agile forums. We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line! See this thread and this one for details.
Input will be vector whose each element will itself be a vector.Length of vector of each element may vary for different calls.Only the selected element needs to be placed in proper order in the output.For ex. field2 is not required in the output.Also field4 is placed before field3.Below is the code that I tried to write.Can any one help me with better solution.
The Input is vector : "[ [field1,f1_val1,f1_val2,f1_val3,f1_val4] ,[field2,f2_val1,f2_val2,f2_val3,f2_val4], ,[field3,f3_val1,f3_val2,f3_val3,f3_val4,f3_val5], ,[field4,f4_val1,f4_val2]] )
Expected output is : < FIELD Row=1> <field1>f1_val</field1> <field4>f2_val1</filed4> <field3>f3_val1</field3> </FIELD> < FIELD Row=2> <field1>f1_va2</field1> <field4>f2_val2</filed4> <field3>f3_val2</field3> </FIELD> < FIELD Row=3> <field1>f1_va3</field1> <field3>f3_val3</field3> </FIELD> < FIELD Row=4> <field1>f1_val4</field1> <field3>f3_val4</field3> </FIELD> < FIELD Row=5> <field3>f3_val5</field3> </FIELD> Code:
edited by Dave to put the code in the UBB code tags. [ February 27, 2002: Message edited by: Dave Vick ] [ February 27, 2002: Message edited by: smita agarnal ]