Interview Questions

How to sort List of List of String?

SilkTest Questions and Anwsers


(Continued from previous question...)

107. How to sort List of List of String?

[+] testcase test() appstate none
[ ]
[ ] LIST OF LIST OF STRING llsStr =
{{"1234","A"},{"2242","B"},{"2234","C"}}
[ ] Print(Sort(llsStr))
[+] LIST OF LIST OF STRING Sort (LIST OF LIST OF STRING llsStr)
[ ]
[ ] LIST OF STRING lsStr
[ ] INTEGER i, j , k
[ ] k = ListCount(llsStr)
[+] for (i=1;i <= k;i++)
[+] for (j=i+1; j<=k; j++)
[+] if val(llsStr[i][1]) > val (llsStr[j][1])
[ ] lsStr = llsStr[j]
[ ] llsStr[j] = llsStr[i]
[ ] llsStr[i] = lsStr
[ ]
[ ]
[ ] return llsStr

(Continued on next question...)

Other Interview Questions