jupevi
Messages postés3Date d'inscriptionmardi 26 mai 2009StatutMembreDernière intervention30 septembre 2011 30 sept. 2011 à 18:12
Merci Ghuymans99, c'est meilleure comme ça.
J'apprécie tous les conseils.
cs_ghuysmans99
Messages postés3982Date d'inscriptionjeudi 14 juillet 2005StatutMembreDernière intervention30 juin 201316 30 sept. 2011 à 17:54
#For g = 1 To num#If Mid$(aser, g, 1) Mid$(NA, g, 1) Or Mid$(aser, g, 1) "*" Then
#L = L + 1
#''Else -->useless !
#''L = L
#End If
#If [...] Then
#[...]
#End
#''Else -->useless, put the 1st and the 2nd lines together
#''End If
#''If i = 0 Then GoTo 1 --> GOTO is really bad !
#If (Mid$(NA, num + 2, Len(NA) - num) = List1.List(i - 1)) And (i <> 0) Then
#''i = i -->useless !
#Else
#List1.AddItem Mid$(NA, num + 2, Len(NA) - (num - 1)), i
#i = i + 1
#End If
Let's use a simple formula : NOT(a AND b) = (NOT a) OR (NOT b)
So, NOT((Mid$(NA, num + 2, Len(NA) - num) = List1.List(i - 1)) And (i <> 0))
Becomes (Mid$(NA, num+2, Len(NA)-num) <> List1.List(i-1)) Or (i=0) ::
#If (Mid$(NA, num+2, Len(NA)-num) <> List1.List(i-1)) Or (i=0) Then
# List1.AddItem Mid$(NA, num + 2, Len(NA) - (num - 1)), i
# i = i + 1
#End If
Indenting your code is also a good idea : it'll be easier to read for others ...
30 sept. 2011 à 18:12
J'apprécie tous les conseils.
30 sept. 2011 à 17:54
#L = L + 1
#''Else -->useless !
#''L = L
#End If
#If [...] Then
#[...]
#End
#''Else -->useless, put the 1st and the 2nd lines together
#''End If
#''If i = 0 Then GoTo 1 --> GOTO is really bad !
#If (Mid$(NA, num + 2, Len(NA) - num) = List1.List(i - 1)) And (i <> 0) Then
#''i = i -->useless !
#Else
#List1.AddItem Mid$(NA, num + 2, Len(NA) - (num - 1)), i
#i = i + 1
#End If
Let's use a simple formula : NOT(a AND b) = (NOT a) OR (NOT b)
So, NOT((Mid$(NA, num + 2, Len(NA) - num) = List1.List(i - 1)) And (i <> 0))
Becomes (Mid$(NA, num+2, Len(NA)-num) <> List1.List(i-1)) Or (i=0) ::
#If (Mid$(NA, num+2, Len(NA)-num) <> List1.List(i-1)) Or (i=0) Then
# List1.AddItem Mid$(NA, num + 2, Len(NA) - (num - 1)), i
# i = i + 1
#End If
Indenting your code is also a good idea : it'll be easier to read for others ...