list_eraseSyntaxeListErase(Lst, Nro) Efface un élément précis dans une liste. Deux paramètres : 1. La liste à modifier (Lst) au format liste. 2. Le numéro de l'élément à supprimer (Nro) au format nombre. Le résultat est au format liste. Par Fredo d;o) ExempleListErase({"Un", "Deux", "Quatre", "Trois"}, 3) ---> {"Un", "Deux", "Trois"}
Scripton ListErase(Lst, Nro) set NbrItms to (length of Lst) if (NbrItms is 0) or (Nro is 0) then return Lst if (Nro = NbrItms) then return (items 1 thru -2 of Lst) else if (Nro = -NbrItms) then return (items 2 thru -1 of Lst) else if (Nro < NbrItms) and (Nro > -NbrItms) then return (items 1 thru (Nro - 1) of Lst) & ¬ (items (Nro + 1) thru -1 of Lst) else return Lst end if end ListErase
|