J'ai crée une procedure pour comparer les nombres
dite-moi ce que vous en penssez

Code : Tout sélectionner
; Programme réaliser par Monsieur Dieppedalle Davvid
; Explication du programme:
; Ce programme sert a comparer des nombres et ensuite de sortir
; une série de nombre voulue suivent la condition
; Les conditions (Sortie$) supportées sont:
; "+" Les nombres seront trier du plus grand au plus petit
; "-" Les nombres seront trier du plus petit au plus grand
; "<X" Inférieur a X (X étans le nombre)
; ">X" Suppérieur a X (X étans le nombre)
; "<=X" ou "=<" (revient au même) Inférieur ou Egale a X (X étans le nombre)
; "=>X" ou ">=" (revient au même) Suppérieur ou Egale a X (X étans le nombre)
; "<>X" Différent de X (X étans le nombre)
; Possibilité de choisir le nombre de décimale (NombreDecimale) qu'auront les nombres a leur sortie
; Possibilité de choisir le nombre de nombre a sortir
Global NewList ListeNombreEntree.d()
Global NewList ListeNombreTemps.d()
Global NewList ListeNombreSortie.d()
Global NombreTemps.d
Procedure.l IsNumerique(Chaine$)
; En gros si la chaine extrait est bien un nombre, on renvoie true = 1, sinon on renvoie false = 0
If Not Chaine$ Or Chaine$ = "."
ProcedureReturn #False
EndIf
For Caractere = 0 To 255
Select Caractere
Case 0 To 45, 47, 58 To 255
If FindString(Chaine$, Chr(Caractere), 1)
ProcedureReturn #False
EndIf
EndSelect
Next
If CountString(Chaine$, ".") > 1
ProcedureReturn #False
EndIf
ProcedureReturn #True
EndProcedure
Procedure AjouterNombreListeNombre(Nombre$)
; En gros si la chaine extrait est bien un nombre, on l'ajoute a la liste de nombre, sinon on igniore cette chaine
Nombre$ = RemoveString(Nombre$, Chr(32))
For AjoutNombre = 1 To CountString(Nombre$, ",") + 1
AddElement(ListeNombreEntree())
NombreExtrait$ = StringField(Nombre$, AjoutNombre, ",")
If NombreExtrait$ <> "" And IsNumerique(NombreExtrait$)
ListeNombreEntree() = ValD(StringField(Nombre$, AjoutNombre, ","))
EndIf
Next
EndProcedure
Procedure.s CompareNombre(List, Sortie$ = "+", NombreDecimale = 3, NombreResultaSortie = 2)
; Création d'une deuxième liste
ForEach ListeNombreEntree()
AddElement(ListeNombreTemps())
ListeNombreTemps() = ListeNombreEntree()
AddElement(ListeNombreSortie())
ListeNombreSortie() = ListeNombreEntree()
Next
; Trie de la liste
Sortie$ = ReplaceString(Sortie$, Chr(32), "")
If Sortie$ = "+"
SortList(ListeNombreSortie(), #PB_Sort_Descending)
ElseIf Sortie$ = "-"
SortList(ListeNombreSortie(), #PB_Sort_Ascending)
ElseIf FindString(Sortie$, ">", 1) And Not FindString(Sortie$, "<", 1) And Not FindString(Sortie$, "=", 1)
ExtractionNombre$ = Mid(Sortie$, 2)
If IsNumerique(ExtractionNombre$)
If FindString(Sortie$, ">" + ExtractionNombre$, 1)
Supperioriter.d = ValD(ExtractionNombre$)
ForEach ListeNombreSortie()
If ListeNombreSortie() <= Supperioriter
Debug "Supprimer: " + Str(ListeNombreSortie())
ListeNombreSortie() = 0
EndIf
Next
SortList(ListeNombreSortie(), #PB_Sort_Descending)
ForEach ListeNombreSortie()
If ListeNombreSortie() = 0
DeleteElement(ListeNombreSortie(), 1)
EndIf
Next
EndIf
EndIf
ElseIf FindString(Sortie$, "<", 1) And Not FindString(Sortie$, ">", 1) And Not FindString(Sortie$, "=", 1)
ExtractionNombre$ = Mid(Sortie$, 2)
If IsNumerique(ExtractionNombre$)
If FindString(Sortie$, "<" + ExtractionNombre$, 1)
Supperioriter.d = ValD(ExtractionNombre$)
ForEach ListeNombreSortie()
If ListeNombreSortie() => Supperioriter
Debug "Supprimer: " + Str(ListeNombreSortie())
ListeNombreSortie() = 0
EndIf
Next
SortList(ListeNombreSortie(), #PB_Sort_Descending)
ForEach ListeNombreSortie()
If ListeNombreSortie() = 0
DeleteElement(ListeNombreSortie(), 1)
EndIf
Next
EndIf
EndIf
ElseIf (FindString(Sortie$, "<", 1) And FindString(Sortie$, ">", 1)) And Not FindString(Sortie$, "<>", 1) And Not FindString(Sortie$, "=", 1)
ExtractionNombre1$ = Mid(Sortie$, 2, FindString(Sortie$, ">", 1) - 2)
ExtractionNombre2$ = Mid(Sortie$, FindString(Sortie$, ">", 1) + 1)
If IsNumerique(ExtractionNombre1$) And IsNumerique(ExtractionNombre2$)
If FindString(Sortie$, "<" + ExtractionNombre1$ + ">" + ExtractionNombre2$, 1)
Inferioriter.d = ValD(ExtractionNombre1$)
Supperioriter.d = ValD(ExtractionNombre2$)
ForEach ListeNombreSortie()
If ListeNombreSortie() <= Supperioriter Or ListeNombreSortie() => Inferioriter
Debug "Supprimer: " + Str(ListeNombreSortie())
ListeNombreSortie() = 0
EndIf
Next
SortList(ListeNombreSortie(), #PB_Sort_Descending)
ForEach ListeNombreSortie()
If ListeNombreSortie() = 0
DeleteElement(ListeNombreSortie(), 1)
EndIf
Next
EndIf
EndIf
ElseIf FindString(Sortie$, "<>", 1)
ExtractionNombre$ = Mid(Sortie$, 3)
If IsNumerique(ExtractionNombre$)
If FindString(Sortie$, "<>" + ExtractionNombre$, 1)
Differenciter.d = ValD(ExtractionNombre$)
ForEach ListeNombreSortie()
If ListeNombreSortie() = Differenciter
Debug "Supprimer: " + Str(ListeNombreSortie())
ListeNombreSortie() = 0
EndIf
Next
SortList(ListeNombreSortie(), #PB_Sort_Descending)
ForEach ListeNombreSortie()
If ListeNombreSortie() = 0
DeleteElement(ListeNombreSortie(), 1)
EndIf
Next
EndIf
EndIf
ElseIf FindString(Sortie$, "<=", 1) Or FindString(Sortie$, "=<", 1)
ExtractionNombre$ = Mid(Sortie$, 3)
If IsNumerique(ExtractionNombre$)
If FindString(Sortie$, "<=" + ExtractionNombre$, 1) Or FindString(Sortie$, "=<" + ExtractionNombre$, 1)
InferioriterOuEgaliter.d = ValD(ExtractionNombre$)
ForEach ListeNombreSortie()
If ListeNombreSortie() > InferioriterOuEgaliter
Debug "Supprimer: " + Str(ListeNombreSortie())
ListeNombreSortie() = 0
EndIf
Next
SortList(ListeNombreSortie(), #PB_Sort_Descending)
ForEach ListeNombreSortie()
If ListeNombreSortie() = 0
DeleteElement(ListeNombreSortie(), 1)
EndIf
Next
EndIf
EndIf
ElseIf FindString(Sortie$, "=>", 1) Or FindString(Sortie$, ">=", 1)
ExtractionNombre$ = Mid(Sortie$, 3)
If IsNumerique(ExtractionNombre$)
If FindString(Sortie$, "=>" + ExtractionNombre$, 1) Or FindString(Sortie$, ">=" + ExtractionNombre$, 1)
SupperioriterOuEgaliter.d = ValD(ExtractionNombre$)
ForEach ListeNombreSortie()
If ListeNombreSortie() < SupperioriterOuEgaliter
Debug "Supprimer: " + Str(ListeNombreSortie())
ListeNombreSortie() = 0
EndIf
Next
SortList(ListeNombreSortie(), #PB_Sort_Descending)
ForEach ListeNombreSortie()
If ListeNombreSortie() = 0
DeleteElement(ListeNombreSortie(), 1)
EndIf
Next
EndIf
EndIf
EndIf
ForEach ListeNombreSortie()
Liste + 1
If NombreResultaSortie <> -1 And Liste < NombreResultaSortie + 1
ListeNombreSortie$ + StrD(ListeNombreSortie(), NombreDecimale) + ", "
ElseIf NombreResultaSortie = -1
ListeNombreSortie$ + StrD(ListeNombreSortie(), NombreDecimale) + ", "
Else
Break
EndIf
Next
ProcedureReturn ListeNombreSortie$
EndProcedure
Nombre$ = "50, 150, 255"
AjouterNombreListeNombre(Nombre$)
Debug CompareNombre(ListeNombreEntree(), "+", 0, 3)