Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Help decoding function
Message
 
À
23/12/2004 07:45:22
Information générale
Forum:
Visual FoxPro
Catégorie:
Problèmes
Versions des environnements
Database:
Visual FoxPro
Divers
Thread ID:
00971747
Message ID:
00971759
Vues:
20
May be something like that (I don't know what CDec() function returns in VB)
FUNCTION ConvTo36(strValue10)
   LOCAL varWrk, varVal, strResult
   strResult = ""
   varVal = VAL(strValue10) && Here I don't know
   DO WHILE varVal # 0
       varWrk = ((varVal / 36) - Int(varVal / 36)) * 36
       varVal = Int(varVal / 36)
       varWrk = Int(varWrk + 0.5)
       If (varWrk < 10)
           strResult = Chr(Asc("0") + varWrk) + strResult
       Else
          strResult = Chr(Asc("A") + varWrk - 10) + strResult
       End If
   ENDDO
   Tal10ToTal36 = strResult && You may be not need this line

RETURN strResult
>Can somebody help me in decoding a piece of code from VB to Visual Foxpro
>I need to encode a normal numer like 20041010001 to a special code for a machine. The have given me the code for VB but i don't have and know VB.
>Can someone help me?
>
>Best regards,
>
>Frits
>
>
>FUNCTION convto36(strValue10 As String) As String
>
> Dim varWrk As Variant
> Dim varVal As Variant
> Dim strResult As String
>
> strResult = ""
>
> varVal = CDec(strValue10)
> Do While (varVal <> 0)
> varWrk = ((varVal / 36) - Int(varVal / 36)) * 36
> varVal = Int(varVal / 36)
> varWrk = Int(varWrk + 0.5)
> If (varWrk < 10) Then
> strResult = Chr(Asc("0") + varWrk) & strResult
> Else
> strResult = Chr(Asc("A") + varWrk - 10) & strResult
> End If
> Loop
> Tal10ToTal36 = strResult
>
> ENDFUNC
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform