Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How qsort a str variable?
#2
The qsort function is not very easy to use but it is universal.

Example:
Code:
Copy      Help
str a=
;John
;Paul
;Marcus
;Ariel


ARRAY(str) b=a
qsort &b[0] b.len sizeof(str) &sortstrproc
a=b
out a

Function sortstrproc:
Code:
Copy      Help
function[c] str&s1 str&s2
int i=q_stricmp(s1 s2)
if(i>0) ret 1
if(i<0) ret -1


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)