CONVERTIR LES MIN EN MAJ ET LES MAJ EN MIN. DANS UNE CHAINE DE CARACTÈRE
cs_Groucho
Messages postés26Date d'inscriptionmercredi 12 février 2003StatutMembreDernière intervention14 mars 2005
-
2 août 2003 à 08:52
gabchampagne
Messages postés216Date d'inscriptionmercredi 2 avril 2003StatutMembreDernière intervention 5 mai 2004
-
28 août 2003 à 04:51
Cette discussion concerne un article du site. Pour la consulter dans son contexte d'origine, cliquez sur le lien ci-dessous.
gabchampagne
Messages postés216Date d'inscriptionmercredi 2 avril 2003StatutMembreDernière intervention 5 mai 2004 28 août 2003 à 04:51
j'aurais pu aussi faire :
Function inverser_min_maj(str As String) As String
Dim lelen As Long, carac As String, total As String
lelen = Len(str)
For i = 1 To lelen
carac = Mid$(str, i, 1)
If carac LCase$(carac) Then total total & UCase$(carac):Else:total= total & LCase$(carac)
Next
inverser_min_maj = total
End Function
Tilois
Messages postés721Date d'inscriptiondimanche 10 juin 2001StatutMembreDernière intervention27 mars 20117 27 août 2003 à 20:59
logisim > merci.. la source de départ été un peu "brouillon" a mon gout
logisim
Messages postés49Date d'inscriptionmardi 8 mai 2001StatutMembreDernière intervention14 août 2004 18 août 2003 à 12:22
Plus simple :
Function inverser_min_maj(str As String) As String
Dim carac As String
For i = 1 To Len(str)
carac = Mid$(str, i, 1)
inverser_min_maj inverser_min_maj & IIf(carac LCase$(carac), UCase$(carac), LCase$(carac))
Next i
End Function
cs_Groucho
Messages postés26Date d'inscriptionmercredi 12 février 2003StatutMembreDernière intervention14 mars 2005 2 août 2003 à 08:52
ELSE ou ELSEIF beaucoup plus élégant que cet abominable GOTO
Il y a suffisemment d'instructions en VB pour éviter l'utilisation de cet affreux GOTO (Sauf dans on error).
28 août 2003 à 04:51
Function inverser_min_maj(str As String) As String
Dim lelen As Long, carac As String, total As String
lelen = Len(str)
For i = 1 To lelen
carac = Mid$(str, i, 1)
If carac LCase$(carac) Then total total & UCase$(carac):Else:total= total & LCase$(carac)
Next
inverser_min_maj = total
End Function
27 août 2003 à 20:59
18 août 2003 à 12:22
Function inverser_min_maj(str As String) As String
Dim carac As String
For i = 1 To Len(str)
carac = Mid$(str, i, 1)
inverser_min_maj inverser_min_maj & IIf(carac LCase$(carac), UCase$(carac), LCase$(carac))
Next i
End Function
2 août 2003 à 08:52
Il y a suffisemment d'instructions en VB pour éviter l'utilisation de cet affreux GOTO (Sauf dans on error).