LETTRE EN CHIFFRE

oranat Messages postés 2 Date d'inscription vendredi 6 mai 2011 Statut Membre Dernière intervention 20 juillet 2011 - 20 juil. 2011 à 07:47
 acive - 12 déc. 2012 à 12:26
Bonjour,
j'ai besoin de votre aide, j'ai besoin d'un algorithme qui transforme les lettres en chiffre, j'ai déjà réussi à faire l'inverse, c'est à dire les chiffres en lettre mais j'ai encore besoin d'aide pour les LETTRES EN CHIFFRES! s'il vous plait aidez moi.
merci!
(uniquement sur VB6 si possible)

32 réponses

ucfoutu Messages postés 18038 Date d'inscription lundi 7 décembre 2009 Statut Modérateur Dernière intervention 11 avril 2018 219
20 juil. 2011 à 07:56
Bonjour,

Qu'entends-tu exactement par là ?
S'agit-il de "chiffres" ou de nombres ?

Donne un ou deux exemples (chaine/origine ===>> chaine/résultat).



____________________
Utiliser le bouton "REPONSE ACCEPTEE" sur une réponse exacte facilite les recherches ultérieures d'autres forumeurs. PENSEZ-Y SVP
0
oranat Messages postés 2 Date d'inscription vendredi 6 mai 2011 Statut Membre Dernière intervention 20 juillet 2011
20 juil. 2011 à 11:42
exemple : un million ==> 1000000
deux cent soixante douze ==> 272

il y a un programme qui transforme des chiffres en lettre, il doit o6 y avoir un programme qui fait l'inverse
0
ucfoutu Messages postés 18038 Date d'inscription lundi 7 décembre 2009 Statut Modérateur Dernière intervention 11 avril 2018 219
20 juil. 2011 à 12:26
exemple : un million ==> 1000000
deux cent soixante douze ==> 272

il y a un programme qui transforme des chiffres en lettre, il doit o6 y avoir un programme qui fait l'inverse


Non !
Je ne crois pas qu'un tel programme existe (quelle pourrait d'ailleurs en être l'utilité ?)
Il est néanmoins possible de s'amuser à le faire, mais :
1) à condition que la syntaxe (en lettres) soit parfaitement respectée (et déjà : la tienne ne l'est pas, dans l'exemple que tu donnes )
2) faire un algo semi-intelligent ===>> quel est le tien ?

Je ne crois pas, s'agissant de ce que je regarde comme une futilité, que tu trouveras beaucoup de forumeurs acceptant de dépenser du temps pour faire à ta place : et l'algo et le code subséquent. A moins que tu ne nous démontres (et on t'attend alors) que tu es vraiment prêt à t'investir dans cette "gymnastique" (et on attend alors, au moins, un effort de ta part résultatnt en un algo).

____________________
Utiliser le bouton "REPONSE ACCEPTEE" sur une réponse exacte facilite les recherches ultérieures d'autres forumeurs. PENSEZ-Y SVP
0
ucfoutu Messages postés 18038 Date d'inscription lundi 7 décembre 2009 Statut Modérateur Dernière intervention 11 avril 2018 219
20 juil. 2011 à 12:38
Ah oui !
Et comme tout cela va passer bien évidemment par l'analyse du texte, elle-même dépendant de la bonne connaissance de la langue utilisée, je te conseille fortement de commencer par t'intéresser à ce que sont :
- les chiffres
- les nombres
- les lettres
- les chaînes de caractères
Si ta demande avait été proportionnelle à ta connaissance du langage naturel (ici : le français), tu l'aurais ainsi exprimée :
" comment retraduire en nombre (au singulier), une chaîne de caractères exprimant en lettres (au pluriel) le nombre en cause"
ce qui nne correspond :
- ni à ton titre
LETTRE EN CHIFFRE

- ni à l'exposé :
c'est à dire les chiffres en lettre

Et comme en plus (voir ce que je t'en ai dit plus haut en ce qui concerne d'autres connaissances) ton raisonnement devra s'appuyer sur une parfaite maitrise de la langue (tant la tienne que celle de celui qui a écrit le nombre en toutes lettres), cela va promettre !

____________________
Utiliser le bouton "REPONSE ACCEPTEE" sur une réponse exacte facilite les recherches ultérieures d'autres forumeurs. PENSEZ-Y SVP
0

Vous n’avez pas trouvé la réponse que vous recherchez ?

Posez votre question
cs_ShayW Messages postés 3258 Date d'inscription jeudi 26 novembre 2009 Statut Membre Dernière intervention 3 décembre 2019 56
20 juil. 2011 à 14:58
Salut

Essaye d'écrire tout seul
peut etre comme ça
à condition qu'entre chaque mot il y a un espace ou un tiret
partage en sous chaine
groupe milliard milllion mille
et chaque groupe et precéder par un chiffre ou nombre entre un et neuf cent quatre vingt dix neuf
c'est vraiment en gros
0
ucfoutu Messages postés 18038 Date d'inscription lundi 7 décembre 2009 Statut Modérateur Dernière intervention 11 avril 2018 219
20 juil. 2011 à 15:21
Bonjour, shayW
Essaye d'imaginer la chaîne:
"Mille un" (1001)
ou (pire) :
"Un Milliard un" (1000000001)


____________________
Utiliser le bouton "REPONSE ACCEPTEE" sur une réponse exacte facilite les recherches ultérieures d'autres forumeurs. PENSEZ-Y SVP
0
cs_ShayW Messages postés 3258 Date d'inscription jeudi 26 novembre 2009 Statut Membre Dernière intervention 3 décembre 2019 56
21 juil. 2011 à 12:16
Salut
Tiens
Dim groupemilliard As String
Dim groupemillion As String
Dim groupemille As String
Dim restegroup As String
Private Sub SplitInGroup(Chaine As String)
 Dim mille As Integer
 Dim milliard As Integer
 Dim million As Integer
 Dim strmilliard As String
 Dim strmillion As String
 Dim pos As Integer
 strm = ""
 pos = 1
 'on cherche le milliard
 Chaine = LCase(Chaine)
 milliard = InStr(1, Chaine, "milliard")
 If milliard > 0 Then
   groupemilliard = Mid(Chaine, 1, milliard - 1)
    groupemilliard = Trim(groupemilliard)
  strmilliard = Mid(Chaine, milliard, Len("milliards"))
  strmilliard = Trim(strmilliard)
  pos = milliard + Len(strmilliard)
 End If
 'verifie si milliard ou milliards

 
million = InStr(milliard + Len(strmilliard) + 1, Chaine, "million")
 If million > 0 Then
   groupemillion = Mid(Chaine, milliard + Len(strmilliard) + 1, million - (milliard + Len(strmilliard) + 1))
   groupemillion = Trim(groupemillion)
    strmillion = Mid(Chaine, million, Len("millions"))
    strmillion = Trim(strmillion)
    pos = million + Len(strmillion)
 End If
 If million > 0 Then
    mille = InStr(million + Len(strmillion) + 1, Chaine, "mille")
    If mille > 0 Then
       groupemille = Mid(Chaine, million + Len(strmillion) + 1, mille - (million + Len(strmillion) + 1))
       groupemille = Trim(groupemille)
       pos = mille + Len("mille")
    End If
 Else
    mille = InStr(milliard + Len(strmilliard) + 1, Chaine, "mille")
    If mille > 0 Then
       If mille = 1 Then
         groupemille = "un"
         Else
           groupemille = Mid(Chaine, milliard + Len(strmilliard) + 1, mille - (milliard + Len(strmilliard) + 1))
          groupemille = Trim(groupemille)
        End If
    End If
 End If
  
 If Len(Chaine) - pos >= 1 Then
    restegroup = Mid(Chaine, pos)
  End If
  
 If mille > 0 Then
  restegroup = Mid(Chaine, mille + Len("mille"))
 End If
 

End Sub

Public Function WordsToNumber(strword As String) As Double

 SplitInGroup strword
WordsToNumber = LettreToNumber(groupemilliard) * 10 ^ 9 + LettreToNumber(groupemillion) * 10 ^ 6 + LettreToNumber(groupemille) * 10 ^ 3 + LettreToNumber(restegroup)
End Function

Private Function LettreToNumber(group As String) As Integer
Dim parts() As String
Dim acc As Integer
Dim acc20 As Integer
Dim acc100 As Integer
Dim flag20 As Boolean
Dim flag100 As Boolean
Dim lenparts As Integer
flag20 = False
flag100 = False
acc = 0
group = Replace(group, "-", " ")
parts = Split(group, " ")
lenparts = UBound(parts)
While lenparts >= 0
  Select Case parts(lenparts)
      Case "un": acc = acc + 1
      Case "deux"
             If flag100 Then
              acc = acc * 2 + acc100
               flag100 = False
              Else
                acc = acc + 2
              End If
      Case "trois"
              If flag100 Then
              acc = acc * 3 + acc100
               flag100 = False
              Else
                acc = acc + 3
              End If
      Case "quatre"
            If flag20 Then
              acc = acc * 4 + acc20
              Else
               acc = acc + 4
            End If
            If flag100 Then
              acc = acc * 4 + acc100
               flag100 = False
            End If
      Case "cinq"
                If flag100 Then
              acc = acc * 5 + acc100
               flag100 = False
              Else
                acc = acc + 5
              End If
      Case "six"
              If flag100 Then
              acc = acc * 6 + acc100
               flag100 = False
              Else
                acc = acc + 6
              End If
              
      Case "sept"
             If flag100 Then
              acc = acc * 7 + acc100
               flag100 = False
              Else
                acc = acc + 7
              End If
              
      Case "huit"
             If flag100 Then
              acc = acc * 8 + acc100
               flag100 = False
              Else
                acc = acc + 8
              End If
      Case "neuf"
              If flag100 Then
              acc = acc * 9 + acc100
               flag100 = False
              Else
                acc = acc + 9
              End If
      Case "dix": acc = acc + 10
      Case "onze": acc = acc + 11
      Case "douze": acc = acc + 12
      Case "treize": acc = acc + 13
      Case "quatorze": acc = acc + 14
      Case "quinze": acc = acc + 15
      Case "seize": acc = acc + 16
      Case "vingt": acc20 = acc
               acc = 20
              flag20 = True
      Case "vingts": acc20 = acc
              acc = 20
              flag20 = True
      Case "trente": acc = acc + 30
      Case "quarante": acc = acc + 40
      Case "cinquante": acc = acc + 50
      Case "soixante": acc = acc + 60
      Case "cent": acc100 = acc
                   acc = 100
                   flag100 = True
      Case "cents": acc100 = acc
                   acc = 100
                   flag100 = True
    End Select
    lenparts = lenparts - 1
Wend
    If flag100 Then
    acc = acc100 + acc
    End If
LettreToNumber = acc
End Function


ps essaye avec
"Vincent mit l'âne dans un pré (et s'en vint dans l'autre)"
0
ucfoutu Messages postés 18038 Date d'inscription lundi 7 décembre 2009 Statut Modérateur Dernière intervention 11 avril 2018 219
21 juil. 2011 à 12:42
Bonjour, bigfish,
Tu devrais essayer de me payer la différence entre ton résultat et le bon, avec
"deux millions deux cents"
Allez ===>> corrige et je reviens avec aut'chose

____________________
Utiliser le bouton "REPONSE ACCEPTEE" sur une réponse exacte facilite les recherches ultérieures d'autres forumeurs. PENSEZ-Y SVP
0
ucfoutu Messages postés 18038 Date d'inscription lundi 7 décembre 2009 Statut Modérateur Dernière intervention 11 avril 2018 219
21 juil. 2011 à 13:11
Bon allez ...
J'ai trouvé ton erreur.
La "chose" n'arrive qu'après plusieurs essais à partir du texte d'une textbox.
Surtout si tu testes d'abord du "gros", puis reviens à du "plus petit"
Pourquoi ? ===>> ce sont tes
Dim groupemilliard As String
Dim groupemillion As String
Dim groupemille As String
Dim restegroup As String

qu'il ne faut surtout pas placer dans la partie générale (sinon ils gardent leur valeur)

____________________
Utiliser le bouton "REPONSE ACCEPTEE" sur une réponse exacte facilite les recherches ultérieures d'autres forumeurs. PENSEZ-Y SVP
0
cs_ShayW Messages postés 3258 Date d'inscription jeudi 26 novembre 2009 Statut Membre Dernière intervention 3 décembre 2019 56
21 juil. 2011 à 13:32
Bonjour
Bigfish ???

La "chose" n'arrive qu'après plusieurs essais à partir du texte d'une textbox.


je teste et pas trouvé de bug


Dim groupemilliard As String
Dim groupemillion As String
Dim groupemille As String
Dim restegroup As String


déclarer comme global dans le module
0
ucfoutu Messages postés 18038 Date d'inscription lundi 7 décembre 2009 Statut Modérateur Dernière intervention 11 avril 2018 219
21 juil. 2011 à 13:41
Essaye :
Une textbox nommée textbox1 et un bouton de commande nommé Command1

code pour Command1
Private Sub Command1_Click()
  Dim toto As String
  toto = TextBox1.Text
  MsgBox WordsToNumber(toto)
End Sub

Maintenant : dans ta textbox, saisis successivement :
1) "un milliard deux cents" === Clique Command1 et vois
2) "deux millions deux cents" === Clique Command1 et vois
3) "un milliard deux cents" === Clique Command1 et vois
____________________
Utiliser le bouton "REPONSE ACCEPTEE" sur une réponse exacte facilite les recherches ultérieures d'autres forumeurs. PENSEZ-Y SVP
0
ucfoutu Messages postés 18038 Date d'inscription lundi 7 décembre 2009 Statut Modérateur Dernière intervention 11 avril 2018 219
21 juil. 2011 à 13:56
Après, quand tu auras corrigé (facile) ce premier bug :
saisis donc :
"neuf cent quatre-vingt-dix-neuf millions mille" (999001000)
et tu vas voir comment le millier disparaît ...


____________________
Utiliser le bouton "REPONSE ACCEPTEE" sur une réponse exacte facilite les recherches ultérieures d'autres forumeurs. PENSEZ-Y SVP
0
cs_ShayW Messages postés 3258 Date d'inscription jeudi 26 novembre 2009 Statut Membre Dernière intervention 3 décembre 2019 56
21 juil. 2011 à 14:21
Ah oui
j'ai corrigé
Dim groupemilliard As String
Dim groupemillion As String
Dim groupemille As String
Dim restegroup As String
Private Sub SplitInGroup(Chaine As String)
 Dim mille As Integer
 Dim milliard As Integer
 Dim million As Integer
 Dim strmilliard As String
 Dim strmillion As String
 Dim pos As Integer
 ' initialiser 
 groupemilliard = ""
 groupemillion = ""
 groupemille = ""
 restegroup = ""
 strm = ""
 pos = 1
 'on cherche le milliard
 Chaine = LCase(Chaine)
 milliard = InStr(1, Chaine, "milliard")
 If milliard > 0 Then
   groupemilliard = Mid(Chaine, 1, milliard - 1)
    groupemilliard = Trim(groupemilliard)
  strmilliard = Mid(Chaine, milliard, Len("milliards"))
  strmilliard = Trim(strmilliard)
  pos = milliard + Len(strmilliard)
 End If
 'verifie si milliard ou milliards

 
million = InStr(milliard + Len(strmilliard) + 1, Chaine, "million")
 If million > 0 Then
   groupemillion = Mid(Chaine, milliard + Len(strmilliard) + 1, million - (milliard + Len(strmilliard) + 1))
   groupemillion = Trim(groupemillion)
    strmillion = Mid(Chaine, million, Len("millions"))
    strmillion = Trim(strmillion)
    pos = million + Len(strmillion)
 End If
 If million > 0 Then
    mille = InStr(million + Len(strmillion) + 1, Chaine, "mille")
    If mille > 0 Then
       groupemille = Mid(Chaine, million + Len(strmillion) + 1, mille - (million + Len(strmillion) + 1))
       groupemille = Trim(groupemille)
       pos = mille + Len("mille")
    End If
 Else
    mille = InStr(milliard + Len(strmilliard) + 1, Chaine, "mille")
    If mille > 0 Then
       If mille = 1 Then
         groupemille = "un"
         Else
           groupemille = Mid(Chaine, milliard + Len(strmilliard) + 1, mille - (milliard + Len(strmilliard) + 1))
          groupemille = Trim(groupemille)
        End If
    End If
 End If
  
 If Len(Chaine) - pos >= 1 Then
    restegroup = Mid(Chaine, pos)
  End If
  
 
 

End Sub

Public Function WordsToNumber(strword As String) As Double

 SplitInGroup strword
WordsToNumber = LettreToNumber(groupemilliard) * 10 ^ 9 + LettreToNumber(groupemillion) * 10 ^ 6 + LettreToNumber(groupemille) * 10 ^ 3 + LettreToNumber(restegroup)
End Function

Private Function LettreToNumber(group As String) As Integer
Dim parts() As String
Dim acc As Integer
Dim acc20 As Integer
Dim acc100 As Integer
Dim flag20 As Boolean
Dim flag100 As Boolean
Dim lenparts As Integer
flag20 = False
flag100 = False
acc = 0
group = Replace(group, "-", " ")
parts = Split(group, " ")
lenparts = UBound(parts)
While lenparts >= 0
  Select Case parts(lenparts)
      Case "un": acc = acc + 1
      Case "deux"
             If flag100 Then
              acc = acc * 2 + acc100
               flag100 = False
              Else
                acc = acc + 2
              End If
      Case "trois"
              If flag100 Then
              acc = acc * 3 + acc100
               flag100 = False
              Else
                acc = acc + 3
              End If
      Case "quatre"
            If flag20 Then
              acc = acc * 4 + acc20
              Else
               acc = acc + 4
            End If
            If flag100 Then
              acc = acc * 4 + acc100
               flag100 = False
            End If
      Case "cinq"
                If flag100 Then
              acc = acc * 5 + acc100
               flag100 = False
              Else
                acc = acc + 5
              End If
      Case "six"
              If flag100 Then
              acc = acc * 6 + acc100
               flag100 = False
              Else
                acc = acc + 6
              End If
              
      Case "sept"
             If flag100 Then
              acc = acc * 7 + acc100
               flag100 = False
              Else
                acc = acc + 7
              End If
              
      Case "huit"
             If flag100 Then
              acc = acc * 8 + acc100
               flag100 = False
              Else
                acc = acc + 8
              End If
      Case "neuf"
              If flag100 Then
              acc = acc * 9 + acc100
               flag100 = False
              Else
                acc = acc + 9
              End If
      Case "dix": acc = acc + 10
      Case "onze": acc = acc + 11
      Case "douze": acc = acc + 12
      Case "treize": acc = acc + 13
      Case "quatorze": acc = acc + 14
      Case "quinze": acc = acc + 15
      Case "seize": acc = acc + 16
      Case "vingt": acc20 = acc
               acc = 20
              flag20 = True
      Case "vingts": acc20 = acc
              acc = 20
              flag20 = True
      Case "trente": acc = acc + 30
      Case "quarante": acc = acc + 40
      Case "cinquante": acc = acc + 50
      Case "soixante": acc = acc + 60
      Case "cent": acc100 = acc
                   acc = 100
                   flag100 = True
      Case "cents": acc100 = acc
                   acc = 100
                   flag100 = True
    End Select
    lenparts = lenparts - 1
Wend
    If flag100 Then
    acc = acc100 + acc
    End If
LettreToNumber = acc
End Function


ça devrait aller pour l'instant
0
cs_ShayW Messages postés 3258 Date d'inscription jeudi 26 novembre 2009 Statut Membre Dernière intervention 3 décembre 2019 56
21 juil. 2011 à 14:43
voila dernière correction

Dim groupemilliard As String
Dim groupemillion As String
Dim groupemille As String
Dim restegroup As String
Private Sub SplitInGroup(Chaine As String)
 Dim mille As Integer
 Dim milliard As Integer
 Dim million As Integer
 Dim strmilliard As String
 Dim strmillion As String
 Dim pos As Integer
 groupemilliard = ""
 groupemillion = ""
 groupemille = ""
 restegroup = ""
 strm = ""
 pos = 1
 'on cherche le milliard
 Chaine = LCase(Chaine)
 milliard = InStr(1, Chaine, "milliard")
 If milliard > 0 Then
   groupemilliard = Mid(Chaine, 1, milliard - 1)
    groupemilliard = Trim(groupemilliard)
  strmilliard = Mid(Chaine, milliard, Len("milliards"))
  strmilliard = Trim(strmilliard)
  pos = milliard + Len(strmilliard)
 End If
 'verifie si milliard ou milliards
 million = InStr(milliard + Len(strmilliard) + 1, Chaine, "million")
 If million > 0 Then
   groupemillion = Mid(Chaine, milliard + Len(strmilliard) + 1, million - (milliard + Len(strmilliard) + 1))
   groupemillion = Trim(groupemillion)
    strmillion = Mid(Chaine, million, Len("millions"))
    strmillion = Trim(strmillion)
    pos = million + Len(strmillion)
 End If
 If million > 0 Then
    mille = InStr(million + Len(strmillion) + 1, Chaine, "mille")
    If mille > 0 Then
       groupemille = Mid(Chaine, million + Len(strmillion) + 1, mille - (million + Len(strmillion) + 1))
       If groupmille = "" Then
         groupemille = "un"
       Else
          groupemille = Trim(groupemille)
       End If
       pos = mille + Len("mille")
    End If
 Else
    mille = InStr(milliard + Len(strmilliard) + 1, Chaine, "mille")
    If mille > 0 Then
       If mille = 1 Then
         groupemille = "un"
         Else
           groupemille = Mid(Chaine, milliard + Len(strmilliard) + 1, mille - (milliard + Len(strmilliard) + 1))
          groupemille = Trim(groupemille)
        End If
         pos = mille + Len("mille")
    End If
 End If
  
 If Len(Chaine) - pos >= 1 Then
    restegroup = Mid(Chaine, pos)
  End If
  
 
 

End Sub

Public Function WordsToNumber(strword As String) As Double

 SplitInGroup strword
WordsToNumber = LettreToNumber(groupemilliard) * 10 ^ 9 + LettreToNumber(groupemillion) * 10 ^ 6 + LettreToNumber(groupemille) * 10 ^ 3 + LettreToNumber(restegroup)
End Function

Private Function LettreToNumber(group As String) As Integer
Dim parts() As String
Dim acc As Integer
Dim acc20 As Integer
Dim acc100 As Integer
Dim flag20 As Boolean
Dim flag100 As Boolean
Dim lenparts As Integer
flag20 = False
flag100 = False
acc = 0
group = Replace(group, "-", " ")
parts = Split(group, " ")
lenparts = UBound(parts)
While lenparts >= 0
  Select Case parts(lenparts)
      Case "un": acc = acc + 1
      Case "deux"
             If flag100 Then
              acc = acc * 2 + acc100
               flag100 = False
              Else
                acc = acc + 2
              End If
      Case "trois"
              If flag100 Then
              acc = acc * 3 + acc100
               flag100 = False
              Else
                acc = acc + 3
              End If
      Case "quatre"
            If flag20 Then
              acc = acc * 4 + acc20
              Else
               acc = acc + 4
            End If
            If flag100 Then
              acc = acc * 4 + acc100
               flag100 = False
            End If
      Case "cinq"
                If flag100 Then
              acc = acc * 5 + acc100
               flag100 = False
              Else
                acc = acc + 5
              End If
      Case "six"
              If flag100 Then
              acc = acc * 6 + acc100
               flag100 = False
              Else
                acc = acc + 6
              End If
              
      Case "sept"
             If flag100 Then
              acc = acc * 7 + acc100
               flag100 = False
              Else
                acc = acc + 7
              End If
              
      Case "huit"
             If flag100 Then
              acc = acc * 8 + acc100
               flag100 = False
              Else
                acc = acc + 8
              End If
      Case "neuf"
              If flag100 Then
              acc = acc * 9 + acc100
               flag100 = False
              Else
                acc = acc + 9
              End If
      Case "dix": acc = acc + 10
      Case "onze": acc = acc + 11
      Case "douze": acc = acc + 12
      Case "treize": acc = acc + 13
      Case "quatorze": acc = acc + 14
      Case "quinze": acc = acc + 15
      Case "seize": acc = acc + 16
      Case "vingt": acc20 = acc
               acc = 20
              flag20 = True
      Case "vingts": acc20 = acc
              acc = 20
              flag20 = True
      Case "trente": acc = acc + 30
      Case "quarante": acc = acc + 40
      Case "cinquante": acc = acc + 50
      Case "soixante": acc = acc + 60
      Case "cent": acc100 = acc
                   acc = 100
                   flag100 = True
      Case "cents": acc100 = acc
                   acc = 100
                   flag100 = True
    End Select
    lenparts = lenparts - 1
Wend
    If flag100 Then
    acc = acc100 + acc
    End If
LettreToNumber = acc
End Function
0
ucfoutu Messages postés 18038 Date d'inscription lundi 7 décembre 2009 Statut Modérateur Dernière intervention 11 avril 2018 219
21 juil. 2011 à 17:17
Avant tout : je te félicite pour la démarche.
J'aurais toutefois procédé ***différemment.
Pas le temps maintenant de rechercher d'autres bugs éventuels (j'y reviendai pluis tard, si j'en trouve).

*** j'aurais, comme toi, remplacé les "-" par des espaces, mis au singulier tous les pluriels, puis traité, mais ainsi :
- en partant des unités et en remontant
- en remplaçant les dizaines spéciales (par exemple 16) en chaîne telles que "dix 6" (exemple pour seize)
- en traitant spécialement les "sauts" (par exemple d'unités aux milliers sans centaines)
etc...
Le tout dans un tableau dynamique dimensionné au max (par exemple jusqu'aux milliards)
En travaillant dans ce tableau (du bas vers le haut), j'y aurais mis mes traductions en chiffres.
Puis un Join ===>> et un Trim.
Mais ton travail mérite un salut, que je te fais sans hésiter.
Amitiés

____________________
Utiliser le bouton "REPONSE ACCEPTEE" sur une réponse exacte facilite les recherches ultérieures d'autres forumeurs. PENSEZ-Y SVP
0
cs_ShayW Messages postés 3258 Date d'inscription jeudi 26 novembre 2009 Statut Membre Dernière intervention 3 décembre 2019 56
21 juil. 2011 à 21:07
Merci
je pense qu'il y a d'autre methode comme tu dis
en plus il y a le français belge etc
il y a aussi

million 10^6
milliard 10^9
billion 10^12
billiard 10^15
trillion 10^18
gogol 10^100

donc neuf cent quatre vingt dix neuf gogol ....
0
ucfoutu Messages postés 18038 Date d'inscription lundi 7 décembre 2009 Statut Modérateur Dernière intervention 11 avril 2018 219
21 juil. 2011 à 21:24
ouais..
et après, il faudra penser aux chaînes exprimant des décimales (raison pour laquelle je n'ai pas encore fait allusion au remplacement du "et" par rien (ce qui faciliterait bien les choses, pourtant)

____________________
Utiliser le bouton "REPONSE ACCEPTEE" sur une réponse exacte facilite les recherches ultérieures d'autres forumeurs. PENSEZ-Y SVP
0
rnumico Messages postés 1 Date d'inscription jeudi 25 août 2011 Statut Membre Dernière intervention 25 août 2011
25 août 2011 à 17:23
excusez moi j'y connais rien et je voudrais appeller ce code par une macro affectée a un bouton, que doit contenir la macro si j'ecris mon texte (par exemple ... deux cent cinquante) dansla cellule A1 et que je veux la reponse en A2 ???

Merci bcp.
0
DevLama Messages postés 356 Date d'inscription mercredi 13 avril 2011 Statut Membre Dernière intervention 18 novembre 2021 10
22 sept. 2011 à 02:18
Ecoute,ShayW t'embrouille avec plein des codes
utilise la methode ASCII
cela veut dire "LA CRYPTOGRAPHIE ASCII"
Dim Crypter() as Integer ,Lnom as Integer
Dim nom as string , Nomcrypter as Long
Nom=text1.Text
Lnom=Len(Nom)
Redim Crypter(Lnom)
For i=1 to Lnom
Crypter(i)=Asc(Mid(Nom,i,1))
nomcrypter=nomcrypter & crypter(i)
text1=nomcrypter
Next i

Essaie!!!!!!
0
cs_ShayW Messages postés 3258 Date d'inscription jeudi 26 novembre 2009 Statut Membre Dernière intervention 3 décembre 2019 56
22 sept. 2011 à 14:29
Okasa Salut
ça marche

Non Fausse alerte



le but était de traduire une somme en toutes
lettres
trois cent quatre-vingt-dix-sept
ce qui donne 397
et pas d'obtenir la valeur ASCII de chaque lettre
0