CONVERSION TEXTE ASCII

cs_Warny Messages postés 473 Date d'inscription mercredi 7 août 2002 Statut Membre Dernière intervention 10 juin 2015 - 3 mars 2003 à 14:18
cs_Warny Messages postés 473 Date d'inscription mercredi 7 août 2002 Statut Membre Dernière intervention 10 juin 2015 - 3 mars 2003 à 14:18
Cette discussion concerne un article du site. Pour la consulter dans son contexte d'origine, cliquez sur le lien ci-dessous.

https://codes-sources.commentcamarche.net/source/6310-conversion-texte-ascii

cs_Warny Messages postés 473 Date d'inscription mercredi 7 août 2002 Statut Membre Dernière intervention 10 juin 2015
3 mars 2003 à 14:18
Petite question comme ça,
Pourquoi tu n'utilise pas la fonction instring pour récuperer la position du caractère, c'est plus rapide que ta boucle while ?
ça ferait un truc du genre :

Private Sub decrypt_Click()
Dim x as long
Dim hbit as integer, lbit as integer
Const hexCars as String = "0123456789ABCDEF"

For x=1 to len(chaine) step 2 'pour prendre par 2 caractères
hbit = instr(hewCars,mid(chaine,x,1) - 1
lbit = instr(hewCars,mid(chaine,x+1,1) - 1
if hbit -1 or lbit -1 Then
'erreur on traite
end if
lettre = chr(hbit*16 + lbit)
sortie = sortie + lettre
Next
End Sub
Rejoignez-nous