Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Possible bug
Message
De
28/12/2001 10:26:48
Keith Payne
Technical Marketing Solutions
Floride, États-Unis
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
Divers
Thread ID:
00598533
Message ID:
00598800
Vues:
41
Thank you everyone for your input. This thread has creeped away from the original problem. The string was "Keith James Payne" which had 2 spaces between the first and second words and 2 spaces between the second and third words. If there were 3 spaces between 2 words, I agree that STRTRAN() should not convert all 3 spaces into a single space. However, this is not the case in the code I presented.

The help from VFP7 specifically states that *each* occurence of the expression will be replaced. Additionaly, simple tests demonstrate that STRTRAN() does work correctly with a literal string, memvar and property, but does not work correctly in the code from the class I am working on.

- Keith

<snip>

>>
>>Hi Nadya
>>
>>Sorry but you appear to be missing the same point. This is not a bug, the only way it could possibly be a bug is if STRTRAN() were recursive, which it isn't.
>>
>>Consider the following string:
>>
>>"A B" (A, 3 spaces, B)
>>
>>Use STRTRAN() to replace all occurrences of double spaces with single. How many occurrences of two spaces are there in this string? The answer is that there is only ONE occurrence. The result is, therefore:
>>
>>"A B" (A 2 spaces B)
>>
>>However, AFTER the first pass we still have a double space because the first operation created one (the replacement single space PLUS the original single space).
>>
>>It's not a bug, but you do need to use it correctly, like this:
>>
>>lcStr = "A B"
>>? STRTRAN( STRTRAN( lcStr, " ", " " ), " ", " " )
>
>Yep, and this solves two passes, so have the single STRTRAN in a loop ;)
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform