Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Possible bug
Message
 
 
À
28/12/2001 07:52:32
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
Divers
Thread ID:
00598533
Message ID:
00598762
Vues:
50
Hi Andy,

I do understand STRTRAN() function behavior, that's why I suggested to use REDUCE() function from FoxTools to do the job. Zlatin was not explicit in what he was saying so I decided to clarify STRTRAN function behavior from Help. Also I should note, what this is VFP6. Help, since in VFP7.0 we have new parameters added...


>>From Help:
>>
>>Searches a character expression or memo field for occurrences of a second character expression or memo field, and then replaces each occurrence with a third character expression or memo field.
>>
>>Syntax
>>
>>STRTRAN(cSearched, cSearchFor [, cReplacement]
>> [, nStartOccurrence] [, nNumberOfOccurrences])
>>
>>From Help:
>>
>>Searches a character expression or memo field for occurrences of a second character expression or memo field, and then replaces each occurrence with a third character expression or memo field.
>>
>>Syntax
>>
>>STRTRAN(cSearched, cSearchFor [, cReplacement]
>> [, nStartOccurrence] [, nNumberOfOccurrences])
>>
>>You can use REDUCE() function from FoxTools to do the job.
>
>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, " ", " " ), " ", " " )
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform