From: jmichel@... (Jean Michel) Date: 2001-01-04T03:40:01+09:00 Subject: [ruby-talk:8579] Re: [RAA-ANN] strbsrt-0.0.1, string sorting extension In article , David Alan Black wrote: >Hello -- > >I've just placed on RAA version 0.0.1 of strbsrt, an extension >which provides sort_bytes and sort_bytes! methods for strings. >(This grows out of the anagram discussion.) > >Comments and feedback are welcome. qsort is suboptimal for sorting strings. To sort string str in C (I write C code here, I don't know ruby internals) do unsigned char *sort(unsigned char *str) { int count[256],i,j,l;unsigned char *p,*res; for(i=0;i<256;i++)count[i]=0; l=strlen(str); for(i=0;i