Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Text conversion to big number
Message
De
26/09/2020 12:36:12
 
 
À
26/09/2020 12:09:31
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
01676260
Message ID:
01676264
Vues:
42
>Hi,
>
>I need to convert a text. e.g 1.2.11.3 to a number like 1021103 for which I constructed a method:
>
>
>*!* PROCEDURE conversion
>LPARAMETERS lcNumberIn
>
>Local ;
>	lcNewpar As String, ;
>	lcNumberIn As String, ;
>	lnI As Number, ;
>	lnParenteel As Number
>
>
>*!*	? lcNumberIn
>m.lcNewpar = ''
>
>For m.lnI = 1 To Len(Alltrim(m.lcNumberIn ))
>	Do Case
>		Case !Isdigit(Substr(m.lcNumberIn ,m.lnI,1))
>			m.lcNewpar = m.lcNewpar +Substr(m.lcNumberIn ,m.lnI,1)
>		Case Isdigit(Substr(m.lcNumberIn ,m.lnI,1))
>			m.lcNewpar = m.lcNewpar + Iif(Isdigit(Substr(m.lcNumberIn ,m.lnI,1)),Padl(Substr(m.lcNumberIn ,m.lnI,1),2,'0'),Substr(lcParenteel  ,m.lnI,1))
>
>	Endcase
>Endfor 
>m.lcNewpar = Strtran(m.lcNewpar ,'010','1')
>m.lcNewpar = Strtran(m.lcNewpar ,'.','')
>m.lcNewpar = ALLTRIM(Substr(m.lcNewpar ,2))
>RETURN val(m.lcNewpar)
>
>
>Now I come to a text 1.4.2.1.9.1.4.4.1.1.1 which would be 104020109010404010101 however this are to much digits vor VFP to handle thus my method gives 1040201090104+E
>
>How to solve for such big numbers?
>Stay healty,
>Koen

I'm afraid that you must store the number as characters.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform