Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Parsing Puzzle (VFP bug?)
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00605723
Message ID:
00605897
Vues:
12
This is what I am doing, note the LOWER() command to make it only match in a case insensitive environment.

It seems like ATCC() only returns if they are different cases.... which is odd.
Because when I UPPER() them both ATCC() no longer works.

ATC() seems like it might suffer from the smae problem.
*parsetag.prg
LOCAL lcTag, lcHtml
lcTag = [~SELECT NAME='cboempguid' ID='cboempguid' SIZE='1' ] + ;
        [STYLE='BACKGROUND:~%=IIF(poError.EmpGuid, 'red', ] + ;
        ['#FFFFFF')%~;FONT:normal normal 9pt Arial;HEIGHT:24;] + ;
        [LEFT:310;POSITION:ABSOLUTE;TOP:0;WIDTH:194' ] + ;
        [VALUE='~%=potravail.empguid%~' ] + ;
        [~%=IIF(PLDISABLEEMPLOYES,'DISABLED','')%~~]
lcHtml = REPLICATE('0', 1800) + lctag + REPLICATE('0', 11000)
*lcHTML= lower(m.lchtml)

? "Testing AT_C and ATCC"
? AT_C(lctag, lcHtml)                && result is 0
? atcc(lcTag, lcHtml)                && result is 1801
? AT_C(UPPER(lctag), UPPER(lcHtml))  && result is 1801
? ATCC(UPPER(lctag), UPPER(lcHtml))  && result is 0

? "Testting  AT and ATC"
? atc(lctag, lcHtml)                 && result is 1801
? atc(upper(lctag), upper(lcHtml))   && result is 0
? AT(lctag, lcHtml)                  && result is 0
? AT(UPPER(lctag), upper(lcHtml))    && result is 1801
>Interesting... ATC_C works OK with my test case but ATCC doesn't.
>
>Of course my test case does have equivalent case throughout but the real world doesn't always.
>
>But frankly I never would have thought to use it because I always thought it was restricted to DBCS only. On re-reading I see I was wrong (on yet another).
>
>Jim
>
>
>>Try AT_C()
>>inplace of ATC()
>>
>>Worked for me with your code
>>
>>>I have a puzzle for anyone interested. One of my programs fails the ATC command looking for a var of 269 characters in a larger one of about 12000 characters. I did some tests and discovered that ATC fails sometimes. I can modify my program to use only 255 characters of the var and it works but it is not as perfect as I would like it. Can anyone explain the behaviour as shown below?
>>>
>>>parsetag.prg Imitates my program. ATC fails. But using AT works. So I tried with generic variables and ATC does not fail. I can't explain this.
>>>
>>>Thanks to any one who tries.
>>>
>>>
>>>*parsetag.prg
>>>LOCAL lcTag, lcHtml
>>>lcTag = [~SELECT NAME='cboempguid' ID='cboempguid' SIZE='1' ] + ;
>>>        [STYLE='BACKGROUND:~%=IIF(poError.EmpGuid, 'red', ] + ;
>>>        ['#FFFFFF')%~;FONT:normal normal 9pt Arial;HEIGHT:24;] + ;
>>>        [LEFT:310;POSITION:ABSOLUTE;TOP:0;WIDTH:194' ] + ;
>>>        [VALUE='~%=potravail.empguid%~' ] + ;
>>>        [~%=IIF(PLDISABLEEMPLOYES,'DISABLED','')%~~]
>>>lcHtml = REPLICATE('0', 1800) + lctag + REPLICATE('0', 11000)
>>>? ATC(lctag, bbb)  && result is 0
>>>? ATC(UPPER(lctag), UPPER(bbb))  && result is 0
>>>? AT(lctag, bbb)  && result is 1802
>>>
>>>? ATC(LEFT(lctag, 255), bbb)  && result is 1802
>>>
>>>*parsebbb.prg  && ATC works
>>>*tag is not valid - I had to change some info so UT could accept the message
>>>LOCAL aaa, bbb
>>>aaa = REPLICATE('12345678', 64)
>>>bbb = 'a' + REPLICATE('b', 1800) + aaa + REPLICATE('b', 11000)
>>>? ATC(aaa, bbb)  &&result is 1802
>>>
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform