ATOUTFOX
COMMUNAUTÉ FRANCOPHONE DES PROFESSIONNELS FOXPRO
Visual FoxPro : le développement durable

petites fonctions en dot net pour un environnement similaire à vfp   



L'auteur

eric leissler
France France
Membre Simple
# 0000002784
enregistré le 06/03/2010
http://www.aumeric.fr
67 ans
LEISSLER Eric
85290 MORTAGNE SUR SEVRE
de la société AUMERIC LOGICIELS
Fiche personnelle


Note des membres
pas de note

Contributions > 80 dotnet > 02 VB.net

petites fonctions en dot net pour un environnement similaire à vfp
# 0000000511
ajouté le 15/03/2008 23:42:21 et modifié le 03/07/2008
consulté 8776 fois
Niveau débutant

Description

Bonsoir à tous

quelques fonctions pour rappeler l'enviornement vfp en dotnet

notamment la fonction dift cf( http://www.atoutfox.org/articles.asp?ACTION=FCONSULTER&ID=0000000066)

Bonne nuit à tous

Aumeric

Code source :
Module baseric

    Function alltrim(ByVal monparam)
        Return (LTrim(RTrim(monparam)))
    End Function
    Function alen(ByVal montableau)
        Return montableau.length
    End Function
    Function padl(ByVal chaine, ByVal clong, ByVal remplac)
        Return chaine.padleft(clong, remplac)
    End Function
    Function padr(ByVal chaine, ByVal clong, ByVal remplac)
        Return chaine.padright(clong, remplac)
    End Function
    Function strtran(ByVal chaine, ByVal aremplacer, ByVal parlachaine)
        Replace(chaine, aremplacer, parlachaine)
        Return chaine
    End Function
    Function substr(ByVal chaine, ByVal caracdeb, ByVal nbcarac)
        If (caracdeb - 1) + nbcarac > chaine.length Then
            nbcarac = chaine.length - caracdeb

        End If
        Return chaine.substring(caracdeb - 1, nbcarac)
    End Function
    Function at(ByVal chainecherchée, ByVal chaine)
        Return InStr(chaine, chainecherchée)
    End Function
    Function time()
        Return Format(Now(), "hh:mm:ss")
    End Function
    Function aujourdhui()
        Return Date.Today
    End Function

    Function dift(ByVal t1, ByVal t2)

        Dim theu As String, tmin1 As String, ts As String, th2 As String, tmin2 As String, tsec2 As Integer, r As Integer, rh1 As Integer, rs1 As Integer, rh As Integer, rm As Integer, rs As Integer, retour As String
        Dim heu As Integer, min1 As Integer, s As Integer, h2 As Integer, min2 As Integer, sec2 As Integer




        rh = 0
        rm = 0
        rs = 0
        theu = substr(t1, 1, (at(":", t1) - 1))
        tmin1 = substr(t1, 4, 2)
        ts = substr(t1, 7, 2)
        heu = Val(theu)
        min1 = Val(tmin1)
        s = Val(ts)
        heu = heu * 60
        min1 = min1 * 60
        s = s + min1 + (heu * 60)
        th2 = substr(t2, 1, (at(":", t2) - 1))
        tmin2 = substr(t2, 4, 2)
        tsec2 = substr(t2, 7, 2)
        h2 = Val(th2)
        min2 = Val(tmin2)
        sec2 = Val(tsec2)
        h2 = h2 * 60
        min2 = min2 * 60
        sec2 = sec2 + min2 + (h2 * 60)
        If sec2 > s Then
            r = sec2 - s
        Else
            r = s - sec2
        End If


        retour = nvertem(r)
        Return retour
    End Function

    Function temvern(ByVal temp1)

        temp1 = alltrim(temp1)
        Dim s As String, m As String, h As String, retour As String
        s = substr(temp1, Len(temp1) - 1, 2)
        s = Val(s)
        m = substr(temp1, Len(temp1) - 4, 2)
        m = Val(m) * 60
        h = substr(temp1, 1, Len(temp1) - 6)
        h = Val(h) * 3600
        retour = h + m + s
        Return retour
    End Function

    Function modulo(ByVal adiviser, ByVal diviserpar)
        Return adiviser Mod diviserpar
    End Function


    Function nvertem(ByVal temp1)
        Dim s As Integer, m As Integer, h As Integer, resth As Double, restm As Double
        h = Int(temp1 / 3600)
        resth = modulo(temp1, 3600)
        m = Int((resth) / 60)
        restm = modulo(m, 60)
        s = Int(modulo(resth, 60))
        Return padl(h.ToString, 5, "0") + ":" + padl(m.ToString, 2, "0") + ":" + padl(s.ToString, 2, "0")
    End Function






End Module


Commentaires
le 16/03/2008, eric leissler a écrit :
Bonjour Olivier,
Je viens de faire la modif.
A bientôt
Eric


Publicité

Les pubs en cours :

www.atoutfox.org - Site de la Communauté Francophone des Professionnels FoxPro - v3.4.0 - © 2004-2024.
Cette page est générée par un composant COM+ développé en Visual FoxPro 9.0-SP2-HF3