@repeat en LS

@repeat en LS

Messagepar Michael DELIQUE » 22 Juil 2005 à 17:58

Code : Tout sélectionner
Function Repeat_LS(wChaine As String,wnbRepeat As Integer, wnbTailleMaxi As Integer) As String   
   
   'si la taille maximum est négative la chaine sera tronqué par la gauche
   
   'Déclaration Variable
   Dim I As Integer
   
   On Error Goto ErreurRepeat_LS
   
   If wChaine = "" Then
      Repeat_LS = ""
      Exit Function
   End If
   
   If Abs(wnbRepeat) = 0 Then
      Repeat_LS = wChaine
      Exit Function
   End If
   
   Repeat_LS = ""
   
   For i = 1 To Abs(wnbRepeat)
      Repeat_LS = Repeat_LS+wChaine
   Next
   
   If Len(Repeat_LS) > Abs(wnbTailleMaxi) Then
      If wnbTailleMaxi > 0 Then
         Repeat_LS = Left(Repeat_LS,wnbTailleMaxi )
      Elseif  wnbTailleMaxi < 0 Then
         Repeat_LS = Right(Repeat_LS,wnbTailleMaxi )
      End If
   End If
   
   I = 0
   
   Exit Function
ErreurRepeat_LS:
   Msgbox "(Repeat_LS) Erreur " + Str(Err) + " : " + Cstr(Error)+Chr(10)+"Ligne N° "+Cstr(Erl),16, " ERREUR !"
   I = 0   
   Repeat_LS = ""
   Exit Function
End Function
Cordialement

Michael (SMS-Phobique)
----------------------------
"La théorie, c'est quand on sait tout et que rien ne fonctionne. La pratique, c'est quand tout fonctionne et que personne ne sait pourquoi."
Albert EINSTEIN
Avatar de l’utilisateur
Michael DELIQUE
Administrateur
Administrateur
 
Message(s) : 12183
Inscrit(e) le : 16 Déc 2004 à 10:36
Localisation : Paris/Cergy

Retour vers Chaines de caractères