Home All Groups Group Topic Archive Search About
Author
22 Sep 2006 2:13 PM
Kb
Hello There,

How do i compare string such that A < B<... <Y<Z<BA<BB... <CA... <ZZ

Thanks
KB

Author
22 Sep 2006 2:28 PM
Ciaran O''Donnell
Write a  comparer for it as Z < BA == false in normal coding. You would need
to compare lengths first, then compare two of the same length as normal I
imagine.

HTH

Ciaran O'Donnell

Show quoteHide quote
"Kb" wrote:

> Hello There,
>
> How do i compare string such that A < B<... <Y<Z<BA<BB... <CA... <ZZ
>
> Thanks
> KB
>
Author
22 Sep 2006 8:29 PM
PS
"Kb" <forlist2***@yahoo.com> wrote in message
news:ueHo7El3GHA.1588@TK2MSFTNGP02.phx.gbl...
> Hello There,
>
> How do i compare string such that A < B<... <Y<Z<BA<BB... <CA... <ZZ

It might be best to think of these as numbers but in base 36. Then the above
comparisons would be correct.

PS
Author
23 Sep 2006 4:05 AM
Jay B. Harlow [MVP - Outlook]
In addition to the other comments, you might be able to PadLeft the shorter
string with max length of the two strings...

Something like:

    Public Class SpecialComparer
        Implements IComparer(Of String)

        Public Function Compare(ByVal x As String, ByVal y As String) As
Integer Implements IComparer(Of String).Compare
            Dim totalWidth As Integer = Math.Max(x.Length, y.Length)
            Return String.Compare(x.PadLeft(totalWidth),
y.PadLeft(totalWidth))
        End Function

    End Class




--
Hope this helps
Jay B. Harlow [MVP - Outlook]
..NET Application Architect, Enthusiast, & Evangelist
T.S. Bradley - http://www.tsbradley.net


Show quoteHide quote
"Kb" <forlist2***@yahoo.com> wrote in message
news:ueHo7El3GHA.1588@TK2MSFTNGP02.phx.gbl...
> Hello There,
>
> How do i compare string such that A < B<... <Y<Z<BA<BB... <CA... <ZZ
>
> Thanks
> KB