Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
StrTran() - any known limitations?
Message
De
31/10/2007 11:09:32
 
 
À
31/10/2007 09:38:09
Dragan Nedeljkovich
Now officially retired
Zrenjanin, Serbia
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP1
Divers
Thread ID:
01265319
Message ID:
01265399
Vues:
13
>>>Shouldn't be, the string to replace is coming from the big string, i.e. it's derived from it using substr(), so actually ATC() can be replaced with an AT() here.
>>>
>>>And this goes successfully hundreds of times and then starts skipping some replaces.
>>
>>Why do you need loop in the first place?
>
>My first thought was that StrTran() may not find all occurrences of a string in a string that it's changing, specially if the it may change the length of a string and that the next one to change is moved and its original position now contains the replacement of the previous. In my case, I'm replacing any chr(10) with "". So if there were two CRLF pairs there, the 2nd LF would have been where "f" is now. I wasn't sure that Fox would find that each time, and wrote this function specifically to get that bug kicked out.
>
>Except that I haven't seen this happen at all - probably not since 2.0 or so - but have instead run into this "won't really replace when it's not in the first 234.56K of text".

vfP9 is correct
? LEN(STRTRAN("AAA","A","")) && return 0
? STRTRAN("ABBB","AB","A")   && RETURN ABB
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform