[Gambas-user] Sorting 2D arrays
Gianluigi
bagonergi at gmail.com
Mon Aug 24 14:50:44 CEST 2020
Il giorno lun 24 ago 2020 alle ore 14:34 Fabien Bodard <gambas.fr at gmail.com>
ha scritto:
> Arf..
>
> make a class
>
> 'Class CEpisode
> Static Public SortMode As Integer
> Public Enum bySeriesName, byEpisodeName, byEpisodeNumber '... etc
>
> Public SeriesName As String
> Public EpisodeName As String
> Public EpisodeNumber As Integer
> Public EpisodeDescription As String
> Public EpisodeDatePublished As String
> Public EpisodeIdentifier As String
> Public SeriesDescription As String
>
> Public Sub _Compare(Other As CEpisode) As Integer
>
> Select Case SortMode
> Case bySerieName
> Return Comp(Me.SeriesName, Other.SeriesName)
> Case ByEpisodeName
> Return Comp(Me.EpisodeName, Other.EpisodeName)
> Case ByEpisodNumber
> If Me.EpisodeNumber < Other.EpisodeNumber Then Return -1
> If Me.EpisodeNumber < Other.EpisodeNumber Then Return 1
> Return
>
>
> 'etc...
>
> End Select
>
> End
>
Hi Fabien,
it's true I should have used enumerators, but other than that my class is
nicer :-P
;-D
Ciao e viva il Cognac!
Gianluigi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.gambas-basic.org/pipermail/user/attachments/20200824/6ac11e99/attachment.html>
More information about the User
mailing list