Welcome to Sign in | Help

Re: sql store procedure - inreg care seamana intre ele

  •  10-19-2007, 9:37 AM

    Re: sql store procedure - inreg care seamana intre ele

    mersi baieti f mult

    mai am de facut functia asta:

    FUNCTION Similar (tcStr1, tcStr2) 
    * Compares two strings. Returns a numeric
    * indication of their similarity (0 = not
    * at all similar, 100 = identical).

    * Written by Mike Lewis, June 2002

    LOCAL lcOK
    PRIVATE pnScore

    * Convert each string to simplest form (letters
    * and digits only, all upper case)
    tcStr1 = UPPER(tcStr1)
    tcStr2 = UPPER(tcStr2)
    lcOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"
    tcStr1=CHRTRAN(tcStr1,CHRTRAN(tcStr1,lcOK,""),"")
    tcStr2=CHRTRAN(tcStr2,CHRTRAN(tcStr2,lcOK,""),"")

    IF EMPTY(tcStr1) OR EMPTY(tcStr2)
      * One or both of the strings is now empty
      RETURN 0
    ENDIF

    IF tcStr1 == tcStr2
      * Strings are identical
      RETURN 100
    ENDIF

    * Initialize cumulative score (this will be the
    * total length of all the common substrings)
    pnScore = 0

    * Find all common sub-strings
    FindCommon(tcStr1,tcStr2)

    * We now have the cumulative score. Return this
    * as a percent of the maximum score. The maximum
    * score is the average length of the two strings.
    RETURN pnScore*200 /(LEN(tcStr1)+LEN(tcStr2))

    ENDFUNC 

     

    da parca ar fii mai indicat sa o fac in C# ,de fap pe amandoua

    dar exista o fct similar si stored procedure? 

View Complete Thread
Powered by Community Server (Commercial Edition), by Telligent Systems