Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Problems with the CHRTRAN() function
Message
 
 
À
16/11/2001 04:29:42
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00582596
Message ID:
00582603
Vues:
32
This message has been marked as a message which has helped to the initial question of the thread.
Hi!

I do not know what cause that strange crahs. But I list below a few suggestions and points of view which you should use to check and try:

1. Try sys(1104) function calling before CHRTRAN()
2. Move out "&" from the string, for example:
CHRTRAN(lcNameKey, " ',./;#[]{}=-_+()*^%$£!z"+'&', "")
or even use chr() for it. Though I very doubt about this could help.
3. If lcNameKey is double-byte string, you have to use the CHRTRANC() function.
4. Use m.lcNameKey (lcNameKey could be a field like "lCNameKey")
5. Use following:

STRTRAN(CHRTRAN(lcNameKey, " ',./;#[]{}=-_+()*^%£!z"+'&', "$$$$$$$$$$$$$...$$$$$$$$"), "$", "")

In other words, replace all offending characters by "$" character (not removing them). Then use STRTRAN() to remove all "$" characters. IMO this way more reliable and quick. From simple tests I did figured out that CHRTRAN() is much slower when removing character from string compare to STRTRAN(). Maybe the difference in removing character from string can help in your situation.



>Hello,
>
>As part of a simple data cleaning routine I am using the following code:
>
>lcNameKey = CHRTRAN(lcNameKey, " ',./;#[]{}=-_+()*&^%$£!z", "")
>
>99.9% of the time this code does exactly what you would expect...
>
>However, every once in a while the code instantiates a Fatal Exception C000000005 error (I may have incorrect number of 0's but you know the one I mean)
>
>I cannot see any pattern in the value coming in as lcNameKey, usually a surname or forename and surname.
>
>I am running VFP6 SP5.
>
>The code is called from within a SCAN loop, the error occurs less on low data quantities (< 1000) and more on quantities into the tens of thousands.
>
>Has anybody come across anything similar? Can anyone provide any advice?
>
>TIA
>
>Ben
Vlad Grynchyshyn, Project Manager, MCP
vgryn@yahoo.com
ICQ #10709245
The professional level of programmer could be determined by level of stupidity of his/her bugs

It is not appropriate to say that question is "foolish". There could be only foolish answers. Everybody passed period of time when knows nothing about something.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform