Yves Goergen <[EMAIL PROTECTED]> wrote:
> On 22.06.2007 17:48 CE(S)T, Yves Goergen wrote:
> >     Match m1 = Regex.Match(param1, "^([0-9]+)");
> >     if (m1.Success)
> >     {
> >       Match m2 = Regex.Match(param2, "^([0-9]+)");
> >       if (m2.Success)
> >       {
> >         int cmpNum = int.Parse(m1.Groups[1].Value) -
> >           int.Parse(m2.Groups[1].Value);
> >         if (cmpNum != 0) return cmpNum;
> >       }
> >     }
> >     return String.Compare(param1, param2, true);
> 
> Oh, well, I just realised that this will only sort numbers "naturally"
> at the beginning of strings, but not in the middle or at the end. It
> will be a bit more complex to do that. Maybe I find a sort/compare
> algorithm for it. But at least I know now that it's easy to use. :)
> 

Check out the "sortStrCmp()" function in older versions of
SQLite version 2 in the util.c source file.  See, for example,

   http://www.sqlite.org/cvstrac/fileview?f=sqlite/src/util.c&v=1.42

I think the sortStrCmp() function does what you are after.
--
D. Richard Hipp <[EMAIL PROTECTED]>


-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to