Sunday, 12 November 2017

Vbscript: Sorting String Array with Strcomp

a = array("bangalore","surat","Pune",1)

For i=0 to ubound(a)

For j=0 to ubound(a)
If strComp(a(i),a(j),1) < 0  Then
temp = a(i)
a(i) = a(j)
a(j) = temp
End If
Next

Next

For i=0 to  ubound(a)

   print a(i)
  'It will print 1,bangalore, Pune, surat

Next

No comments:

Post a Comment

Spring Boot : Exception Handler 14